ms access search help

Joined
Nov 29, 2011
Messages
1
Reaction score
0
Hi there hoping that someone can help. I have ended up having to build an access database with very very limited knowledge.... I have pulled together several tables which are all linked to the one main record. I have forms for inputting information and some queries that run across multi tables.

The Issue that i have at the moment with this database is building a search function that allows users to search on one or more data fields. I have a form with unbound fields and a query that has the data that I would like to present to the user. At the moment I am adding a command button to the form with the unbound fields with the following:

stLinkCriteria = "[Ref_number] like " * " & Me![Text0] and [Amount] like " * " & Me![Text2]"
DoCmd.OpenForm stDocName, , , stLinkCriteria

In my head I think this means that the user can use either the ref number or amount to search on and if the field is blank then it will not impact the search...

Could anyone let me know if my thinking is correct?

Thanks
 
Joined
Dec 7, 2011
Messages
16
Reaction score
0
You're close. You must wrap tet string with Quotes.

Try:

Code:
stLinkCriteria = "[Ref_number] like ""*" & Me![Text0] & """  and [Amount] like ""*" & Me![Text2] & """"

Boyd Trimmell, Microsoft MVP - Access Expert
aka HiTechCoach
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top