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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending string to a query

Status
Not open for further replies.

M8KWR

Programmer
Joined
Aug 18, 2004
Messages
864
Location
GB
Hi,

Unsure what is the best way to go about with my issue.

I have a form that has a list box on it, and the user is able to select x number of items.

I want to be able to use this information in a query.

The only way i can think of is to have a hidden textbox on the form that hold the id number of the items that have been selected, and it would look like:

"49D109E0-5B20-4AC2-92BC-09C428B74C55" OR "5CCE536B-F9E6-459D-A510-E725EF1F75D2" OR "A3201A32-CE9B-447D-9CA7-BCC16D7EBDE8" OR "6B396E9D-DE95-4ABA-906C-ACDCAA93F525" OR "9A5777F3-1EBC-4E9E-8E59-C09089704E9A" OR "BFE1F579-F522-47A8-B90E-A085B86E2607" OR "34117C1A-DE85-48A8-996F-E83A6D360855"

And this is passed to the query - but as you can guess it does not work.

What is the best way to go about what i am trying to achieve.

Is there a way to pass an array to a query?

Many thanks for any help or advise in advance.
 
NO.... sorry...

Would this not cause an issue if 2 users are running the file at the same time? Or should this not happen?
 
A big thank you for pointing me in the correct direction, i think my eye sight needs to be checked, having one of those days...

I was looking at a completely different FAQ...
 
There are always multiple solutions to most problems. I hope you find the solution workable. It can be a bit slow with a large number of records.

If the query is the record source of a form or report, I generally write some code that loops through the selected items in the list box to build a where condition to use in the DoCmd.OpenReport method.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top