Using "Like" expressions and referring to external forms.. how?

buddythebest

Registered User.
Local time
Today, 16:00
Joined
Mar 31, 2006
Messages
32
I know that to refer to a field in a different form we do sthing like this Forms![Products]![Product name] (for example). But when i try to use it in a query under criteria with the "Like" expression it treats it as normal text.
What i basically need to do is have a form used as a search facility where one enters information then clicks view (which is a button that opens a datasheet filtered from the query which should have its criteria referring to the information entered in this form).
What i did:
Under the "product name" criteria in the query i entered:
Like (*Forms![SearchForProduct]![Product name]*)
When i press enter it automatically puts the inverted commas and treats it as normal text and does not refer to this form. Anyway, i created a form from this query called "Product search results" then inserted a command button in the "SearchForProduct" form (next to the "product name" field) which opens up "Product search results" . It does not work at all, because as i said before it does not refer to the form. This way of referring to another form worked with many other queries, but with the "Like" expression it doesnt work.

If someone knows an alterantive way of doing this please help me (even if it involves visual basic).

thanks
 
Like "*" & Forms![SearchForProduct]![Product name] & "*"

^
 
thanks a lot... but there's one more problem, i want it to view the filtered form in datasheet view, the default is datasheet and i even went to the form properties and made it not allow other views but it still views it in form view when i open the filtered form. I would really appreciate it if u tell me how i could resolve this. thanks again.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom