Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Posts
    64

    Unanswered: When there are no records, the code doesn't work.

    When ContactStatusID is null the code doesn't work.

    Private Sub Command85_Click()
    'Open Pending Records For This Month
    Form.Filter = "[Rep#]=" & Trim(Me![Combo38].Column(0)) & " AND ([runmonth]) = #6/1/2004#" & " AND ([ContactStatusId])= 2"
    Form.FilterOn = True
    Form.Refresh
    End Sub

    I have 4 click events like above.
    ([ContactStatusId])= 1 (this opens not called records)
    ([ContactStatusId])= 2 (this opens pending records)
    ([ContactStatusId])= 3 (this opens closed records)

    If there are records for ContactStatusId 1,2 or 3 in the database, I can click on the command buttons of each and am able to switch between, not called, pending or closed records. But the problem is; when there's no record for a pending or closed record, I can not switch between not called, pending or closed records. When all the not called records are open and I click on pending or closed, it works, and shows that there are no records for 2 or 3. But from there I can't go back to not called records when I click on the command buttons.
    Note: By default all records are open before a sales call is made to them.

    Can anyone tell me what I can add to the code to remedy this problem?

    Thanks.

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Try checking fo the condition first...

    Code:
    If ThereIsARecordOrWhatever Then
       Form.Filter = "[Rep#]=" & Trim(Me![Combo38].Column(0)) & " AND ([runmonth]) = #6/1/2004#" & " AND ([ContactStatusId])= 2"
       Form.FilterOn = True
       Form.Refresh
    End If


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •