I have an Access database, where I have a form with a textbox (named c1) and a button. When I click the button it opens a datasheet form with information filtered by the textbox value.
The button vba looks like this:
c1.Value = Replace(c1.Value, ",", " Or ")
DoCmd.OpenForm ("dsForm")
The query behind the datasheet looks something like this in design view:
Field: Name1 | Name2
Criteria: | Like [Forms]![Menu]![c1].[value]
This is so I could later export the results of this query to excel.
So my issue is that I want to enter values into the textbox and separate them with a comma, which would be later turner into an Or by vba. Why I'm doing this with 1 textbox not multiple, is because I could have many values that I want to search by.
Right now it works if I enter one value into the textbox, but when I enter 2 values it's not working. I'm pretty sure that the query is taking the whole statement as a string for example if I enter 110,220 it's supposed to be Like "110" or "220", but on the query it would be Like "110 or 220".
I've tried by setting the field to be either a string or a number as well. How would I manipulate the criteria on a query from vba?