Hi everyone
I know this topic has been covered before and my issue is similar but there's one key difference. Here is a screenshot of part of the user interface I've been working on. To filter this datasheet in split form, the user can ideally either type in an agency name (which filters by agency) or select a program code from the combo box.

The search bar works just fine. Here is the code and SQL
VBA:
Code:
Option Compare Database
Option Explicit
Private Sub cmdReset_Click()
Me.txtSearch = ""
Me.SrchText = ""
DoCmd.Requery
Me.txtSearch.SetFocus
End Sub
Private Sub Form_Load()
'DoCmd.GoToRecord , , acNewRec
End Sub
Private Sub SrchText_AfterUpdate()
Me.SrchText.Requery
End Sub
Private Sub txtSearch_Change()
'Create a string (text) variable
Dim vSearchString As String
vSearchString = txtSearch.Text
SrchText.Value = vSearchString
If Len(Me.SrchText) <> 0 And InStr(Len(SrchText), SrchText, " ", vbTextCompare) Then
Exit Sub
End If
'Me.SearchResults = Me.SearchResults.ItemData(1)
'Me.SearchResults.SetFocus
DoCmd.Requery
Me.txtSearch.SetFocus
If Not IsNull(Len(Me.txtSearch)) Then
Me.txtSearch.SelStart = Len(Me.txtSearch)
End If
End Sub
SQL:
Code:
SELECT tblAgencyInformation.Agency, tblAgencyInformation.Subsidiary, tblAgencyInformation.ProgramCodes, tblAgencyInformation.ProgramNotes, tblAgencyInformation.Address, tblAgencyInformation.City, tblAgencyInformation.Prov, tblAgencyInformation.PostalCode, tblAgencyInformation.FirstName, tblAgencyInformation.LastName, tblAgencyInformation.Position, tblAgencyInformation.ContactNotes, tblAgencyInformation.OriginalEmail, tblAgencyInformation.PhoneNumber, tblAgencyInformation.PhoneNotes, tblAgencyInformation.AAExpiryDate, tblAgencyInformation.InsuranceExpiry, tblAgencyInformation.InsuranceExpiryComments, tblAgencyInformation.WSIBYesNo, tblAgencyInformation.WSIBNotes
FROM tblAgencyInformation
WHERE (((tblAgencyInformation.Agency) Like "*" & [Forms]![frmAgencyLookup_FA]![SrchText] & "*"));
Now I think the problem is largely because initially, the programcodes field in the main table used to be program acronyms (e.g. BsCE) but was replaced with it's respective numeric value (e.g. 0212). In addition to this, the entire program codes table was later added to this database called tblProgramCodes. A lot of the values in this table are not present in the programcodes field at all. Here is a pic of the relationship (all one-to-one enforced referential integrity).

I also made an query to append the agency and program codes tables with the following structure:
apc_ID, autonumber, primary key
apc_CodeID, number, links to tblProgramCodes.ID
apc_Agency, number, links to AgencyInfo.ID
And this is what the table looks like:

I've play around with the combo box by doing things like: setting it's control source to the appropriate field, or unbound, putting DoCmd.Requery in the combo box's after_update event property, and adding forms!frmAgencyLook_FA!cboProgramCodes in the query's criteria but nothing has worked and I'm sure it has something to do with how these tables are all related. As usual, any sort of feedback or constructive criticism is always appreciated!