Hello.
I have a main form "frmParent" with 2 subforms. One subform is an input field and the other is simply for lookup off a table, and not linked to the main form.
the lookup subform is called "sbfrmSearchAssociate" with a Search Box "txtSearch" and 2 fields called "LastName" and "FirstName". There's a 3rd field the user is actually trying to retrieve the information from.
The search box should search in LastName and FirstName for the text entered in the search box.
The command button has the following Apply Filter code in the Where Condition:
Code:
=[LastName] Like "*" & [Forms]![sbfrmSearchAssociates]![txtSearchBox] & "*" Or [FirstName] Like "*" & [Forms]![sbfrmSearchAssociates]![txtSearchBox] & "*"
and it works fine when I have the form open on it's own. When I try to use that in the subform, I've changed the code to:
Code:
[Forms]![frmParent]![sbfrmSearchAssociates].[Form]![LastName] Like "*" & [Forms]![frmParent]![sbfrmSearchAssociates].[Form]![txtSearchBox] & "*"
And for some reason it tries to filter the other subform in the main form, even thought I don't have the search subform linked to anything.
Also, it says I can only have 255 characters so I can't also include the search for the first name.
Finally, I don't even think I should be using "Apply Filter" because ie if I search for "John' it will only pull the first occurrence of the "Johnson" and doesn't allow me to filter to the next name "Johnston'.
Can anyone help me perfect this syntax? Each time I hit the button I want to cycle through my list until I get to the right record.
Thanks in advance.