I have a form which contains all the companies we work for. It has a combo box named cboFilterCompany which I am trying to use to filter the company ID field (a text box named tbLngCompanyNamesID)
The cboFilterCompany has the RowSource as:
"SELECT DISTINCT tblSpecialBillingCompanies.fTxtCompany, tblSpecialBillingCompanies.fLngCompanyNamesID
FROM tblSpecialBillingCompanies
WHERE (((tblSpecialBillingCompanies.fTxtCompany) Is Not Null))
ORDER BY tblSpecialBillingCompanies.fTxtCompany;"
which creates 2 columns, fTxtCompany and fLngCompanyNamesID. The BoundColumn is set on 2.
The AfterUpdate event is:
Private Sub cboFilterCompany_AfterUpdate()
If Nz(cboFilterCompany, 0) > 0 Then
Me.Filter = "[tbLngCompanyNamesID] = " & cboFilterCompany
Me.FilterOn = True
Else
MsgBox "ID is missing"
End If
End Sub
It seems to work. At the bottom, it shows 'Record 1 of 1' and that it is filtered. It even shows "[tbLngCompanyNamesID] = 10" in the filter on the form. But it don't show a record. The form is blank when filtered. I have tried it on several different companies and all are the same. I will appreaciate any help.