Senniger1
asked on
Command Button to Open Form and Filter using Wildcard
We have Office 2010. In Access 2010 I have a form named "frmDocket". On this form I have a Text Box named "txtInitials". I also have a Command Button which opens the form "frmDktAtty". On the form "frmDktAtty" I have a field named "RoutedTo".
When you click the Command Button on the form "frmDocket" it currently filters with the logic (txtInitials = RoutedTo).
Here is my code:
DoCmd.OpenForm "frmDktAtty", acNormal, "", _
"[RoutedTo]LIKE " & "'" & "*" & Me![txtInitials] & "*" & "'", , acNormal
What I really need is the following logic, but I cannot figure out how to alter my code (above) without getting an error. I've tried so many variations so please don't ask me what I've already tried.
txtInitials = (Like "* [RoutedTo]*")
Can anyone assist me with this.
Thanks in advance!
When you click the Command Button on the form "frmDocket" it currently filters with the logic (txtInitials = RoutedTo).
Here is my code:
DoCmd.OpenForm "frmDktAtty", acNormal, "", _
"[RoutedTo]LIKE " & "'" & "*" & Me![txtInitials] & "*" & "'", , acNormal
What I really need is the following logic, but I cannot figure out how to alter my code (above) without getting an error. I've tried so many variations so please don't ask me what I've already tried.
txtInitials = (Like "* [RoutedTo]*")
Can anyone assist me with this.
Thanks in advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I used the following and it worked.
DoCmd.OpenForm "frmDktAtty", acNormal, "", _
"[RoutedTo] Like '*" & [txtInitials] & "*'", , acNormal
I realized I had another filter on my form which was causing some of my attempts to fail.
Thanks so much!
DoCmd.OpenForm "frmDktAtty", acNormal, "", _
"[RoutedTo] Like '*" & [txtInitials] & "*'", , acNormal
I realized I had another filter on my form which was causing some of my attempts to fail.
Thanks so much!
ASKER
The "RoutedTo" field contains entries like the following:
JDP, AXT, LDM
MEN, LDM, MCP, PCV
PXT, JDP, JJK
LDM, JJK
I'm tring to filter so that when LDM is in the "txtInitials" field, then only the records which contain LDM in the RoutedTo field appear.
.