Hello there. Is there anyone who can help me?
Ok, here is the scenario:
I have a database table which has a “Stores” field in it among other fields. In this field are a list of stores (codes to identify stores, more specifically) separated by a hyphen. For example: “-ALB-WAL-CVS” (i.e. Albertsons, Walgreens, and CVS)
On a Access form, I have a list box displaying a list of the store codes. Now, what I want to happen when a user selects a store code from the list box and clicks the query command button, is for a list of records to be displayed which contains the selected store code in the “Stores” field of the database.
The name of the list box where the store codes are listed is “lstSelectStore”. Since the selected store code is stored in this variable, I have been trying to use this variable in a query with a LIKE statement so I can see any records with the selected store code in the “Stores” field. The problem is, since the store codes in the “Stores” field act as a single string, it cannot identify individual store codes within the string.
My question is: Can I use the lstSelectStore (store list box) variable successfully in a LIKE statement in Access with a * wildcard which finds a particular store code in the “Stores” field and displays the record? If so, how…or do I need to do something else in VBA to accomplish this?
Any help is appreciated.
Thank you.
Ok, here is the scenario:
I have a database table which has a “Stores” field in it among other fields. In this field are a list of stores (codes to identify stores, more specifically) separated by a hyphen. For example: “-ALB-WAL-CVS” (i.e. Albertsons, Walgreens, and CVS)
On a Access form, I have a list box displaying a list of the store codes. Now, what I want to happen when a user selects a store code from the list box and clicks the query command button, is for a list of records to be displayed which contains the selected store code in the “Stores” field of the database.
The name of the list box where the store codes are listed is “lstSelectStore”. Since the selected store code is stored in this variable, I have been trying to use this variable in a query with a LIKE statement so I can see any records with the selected store code in the “Stores” field. The problem is, since the store codes in the “Stores” field act as a single string, it cannot identify individual store codes within the string.
My question is: Can I use the lstSelectStore (store list box) variable successfully in a LIKE statement in Access with a * wildcard which finds a particular store code in the “Stores” field and displays the record? If so, how…or do I need to do something else in VBA to accomplish this?
Any help is appreciated.
Thank you.