P
PHisaw
Hi,
I am using the following code to filter a datasheet form. It returns the
records expected if customer is selected or customer + contact. If I select
pump type, it gives all that pump type regardless of customer or contact
selected. Will someone please tell me what I'm doing wrong?
Thanks, Pam
Private Sub CmdViewJobList_Click()
Dim stWhere As String
Dim stDoc As String
stDoc = "fJobList"
If Not IsNull(Me.CboCustomer) Then
stWhere = "CustomerName= """ & Me.CboCustomer & """"
End If
If Not IsNull(Me.CboContact) Then
If Len(stWhere) > 0 Then
stWhere = stWhere & " And "
End If
stWhere = "ContactName= """ & Me.CboContact & """"
End If
If Not IsNull(Me.CboPumpType) Then
If Len(stWhere) > 0 Then
stWhere = stWhere & " And "
End If
stWhere = "PumpType= """ & Me.CboPumpType & """"
End If
DoCmd.OpenForm stDoc, acFormDS, , stWhere
End Sub
I am using the following code to filter a datasheet form. It returns the
records expected if customer is selected or customer + contact. If I select
pump type, it gives all that pump type regardless of customer or contact
selected. Will someone please tell me what I'm doing wrong?
Thanks, Pam
Private Sub CmdViewJobList_Click()
Dim stWhere As String
Dim stDoc As String
stDoc = "fJobList"
If Not IsNull(Me.CboCustomer) Then
stWhere = "CustomerName= """ & Me.CboCustomer & """"
End If
If Not IsNull(Me.CboContact) Then
If Len(stWhere) > 0 Then
stWhere = stWhere & " And "
End If
stWhere = "ContactName= """ & Me.CboContact & """"
End If
If Not IsNull(Me.CboPumpType) Then
If Len(stWhere) > 0 Then
stWhere = stWhere & " And "
End If
stWhere = "PumpType= """ & Me.CboPumpType & """"
End If
DoCmd.OpenForm stDoc, acFormDS, , stWhere
End Sub