M
mark.godecke
Hello,
I am an Access beginner trying to create a form to search a database.
Users enter the client's last name, and then a second form called
"Contacts" will open with their information. I got that working easily
enough with the wizard, but I would like the users to be able to enter
just the first part of a client's name, instead of having to match it
exactly.
This is what I have so far, based on other posts to this forum.
stDocName = "Contacts"
stLinkCriteria = "[LastName]=" & Me![SearchBox] & "*"""
DoCmd.OpenForm stDocName, , , stLinkCriteria
When I try and use the button this is attached to, I get the error
"Syntax Error in String in Query expression '[LastName]=SMITH*"" Where
SMITH is can be any name I enter in the Search Box.
I have also tried the same code substituting "LIKE" instead of "="
after stLinkCriteria, but then I get a "Type mismatch" error. Can
someone tell me what I'm doing wrong?
Thank you in advance for your assistance.
I am an Access beginner trying to create a form to search a database.
Users enter the client's last name, and then a second form called
"Contacts" will open with their information. I got that working easily
enough with the wizard, but I would like the users to be able to enter
just the first part of a client's name, instead of having to match it
exactly.
This is what I have so far, based on other posts to this forum.
stDocName = "Contacts"
stLinkCriteria = "[LastName]=" & Me![SearchBox] & "*"""
DoCmd.OpenForm stDocName, , , stLinkCriteria
When I try and use the button this is attached to, I get the error
"Syntax Error in String in Query expression '[LastName]=SMITH*"" Where
SMITH is can be any name I enter in the Search Box.
I have also tried the same code substituting "LIKE" instead of "="
after stLinkCriteria, but then I get a "Type mismatch" error. Can
someone tell me what I'm doing wrong?
Thank you in advance for your assistance.