Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

syntax error [missing operator]

Status
Not open for further replies.

ImStevenB

IS-IT--Management
Apr 6, 2002
66
US
Hello All,

Thanks in advance for the help - here goes

I am trying to program a find by having the user enter the search information in a field on one form and using that information to display the result on another.

I have a form called SearchMSDS and the field that the user enters the information into is called txtCompEntry.

When the user clicks the Search button I use an event procedure as follows

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Z-frmMSDS"
stLinkCriteria = "[Product_Description]=" & "*" & Me![txtCompEntry] & "*"
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria

After entering information, say schmutz, and clicking the button I get the following error

Syntax error [missing operator] in query expression '[Product_Description] = *schmutz*'.

I have trieds to do this as a query and a macro also - any help would be greatly appreciated.

Thank you again.

Im Steven B
 
Here's an update

I have managed to get the following line to work

stLinkCriteria = "[Product_Description]='" & Me![txtCompEntry] & "'"

But this will bring me a result IF what I type in txtCompEntry is an exact match to Product_Description.

The reason I want the *'s around the txtCompEntry is so that I can search for part of the field, just the word clay in Inorganic clay material.

I guess I want to match any part of the field - some of the information in Product_Description is over 200 characters.

Thanks
Im Steven B
 
Like, look into Like in the help files. I think you'll like it.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top