If this question has been asked before, I'm sorry but I can't find an answer anywhere. My problem is that I'm trying to use DoCmd.OpenForm to open a new form based on a field partially or completely matching an input string.
Right now my code is as follows:
This prompts the user for an item number and displays an exact hit (enter ABCD and displays ABCD only). However, I need the user to be able to input AB and have it display all items with AB in the "number" field (such as 12AB12, ABCD, AB0-3, etc.) Note that this field is a string, not a number as the name implies.
A SQL query to do this would look like
but I'm having a hard time getting this into the VBA code.
Thanks in advance for your help.
Right now my code is as follows:
Code:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_AllItems"
stLinkCriteria = "[Item] = [Enter Item #:]"
DoCmd.OpenForm stDocName, , , stLinkCriteria
A SQL query to do this would look like
Code:
WHERE [Item] Like "*" & [Enter Item #:] & "*"
Thanks in advance for your help.