accesslearner
Registered User.
- Local time
- Yesterday, 19:06
- Joined
- Nov 16, 2010
- Messages
- 38

Each combo box row source has a select query
eg. cbocompany
rowsource = SELECT tblcompany.CompanyID, tblcompany.CompanyName FROM tblcompany;
I have a form which has the values based on a query
Recordsource is bound to a query
When i click on company combo then company name should be filtered
when i select the state combo and apply filter than the state records should be filtered
I used the following code .
when I select the fullname combo than the name record should be filtered
I have the following code in my cmdApplyFilter button
Private Sub cmdApplyFilter_Click()
'This code will look to filter records in a subform
'It is using 3 string commands
'The form has 3 combo controls
'It is also using individual if statements
'Finally applying the filter on the subform
'Created by Trevor G January 2010
Dim strcpy As String
Dim strname As String
Dim strstate As String
If IsNull(Me.cbocompany.Value) Then
strcpy = "Like '*'"
Else
strcpy = "='" & Me.cbocompany.Value & "'"
End If
If IsNull(Me.cboname.Value) Then
strname = "Like '*'"
Else
strname = "='" & Me.cboname.Value & "'"
End If
If IsNull(Me.cbostate.Value) Then
strstate = "Like '*'"
Else
strstate = "='" & Me.cbostate.Value & "'"
End If
Me.Form.Filter = " [companyName]" & strcpy & " OR [NameFull]" & strname & " OR [BCMBusinessAddressState]" & strstate
Me.Form.FilterOn = True
End Sub
The apply filter button does not work and i do not get any errors too what am i doing wrong.