I
iamnu
Re: http://allenbrowne.com/ser-28.html
I am using Allen Browne's code to filter a field in my Subform. It
works on some values I enter, but not all, and I have no clue as to
why it doesn't find all the values. The code finds all the values, or
none at all.
Also, how does one "clear" the cboShowSup Combo box once a value has
been entered, to then look for another?
I would appreciate it if someone can lead me to what I am doing wrong
here.
Thanks,
Bernie
I have modified his code to read as follows:
'tblProduct = tblProvider
'tblProductSupplier = tblPayDetail
'SupplierID = ServiceID
Private Sub cboShowSup_AfterUpdate()
Dim strSQL As String
If IsNull(Me.cboShowSup) Then
' If the combo is Null, use the whole table as the RecordSource.
Me.RecordSource = "tblProvider"
Else
strSQL = "SELECT DISTINCTROW tblProvider.* FROM tblProvider " & _
"INNER JOIN tblPayDetail ON " & _
"tblProvider.ProviderID = tblPayDetail.PayDetailID " & _
"WHERE tblPayDetail.ServiceID = " & Me.cboShowSup & ";"
Me.RecordSource = strSQL
End If
End Sub
I am using Allen Browne's code to filter a field in my Subform. It
works on some values I enter, but not all, and I have no clue as to
why it doesn't find all the values. The code finds all the values, or
none at all.
Also, how does one "clear" the cboShowSup Combo box once a value has
been entered, to then look for another?
I would appreciate it if someone can lead me to what I am doing wrong
here.
Thanks,
Bernie
I have modified his code to read as follows:
'tblProduct = tblProvider
'tblProductSupplier = tblPayDetail
'SupplierID = ServiceID
Private Sub cboShowSup_AfterUpdate()
Dim strSQL As String
If IsNull(Me.cboShowSup) Then
' If the combo is Null, use the whole table as the RecordSource.
Me.RecordSource = "tblProvider"
Else
strSQL = "SELECT DISTINCTROW tblProvider.* FROM tblProvider " & _
"INNER JOIN tblPayDetail ON " & _
"tblProvider.ProviderID = tblPayDetail.PayDetailID " & _
"WHERE tblPayDetail.ServiceID = " & Me.cboShowSup & ";"
Me.RecordSource = strSQL
End If
End Sub