PDA

Click to See Complete Forum and Search --> : Retrieving data from a changing query


J. Wesel
Aug 10th, 1999, 12:21 AM
Hi,

I once had to deal with a problem like your's. From my point of view the best solution is to recreate the query each time the user makes changes by creating the query out of several strings. These strings should contain values from the listboxes you mentioned. For instance:

"Select * from " & listbox1.list(listbox1.listindex) & " where " & listbox2.list(listbox2.listindex) & " like " & listbox3.list(listbox3.listindex) & " order by " & listbox4.list(listbox4.listindex)

Then requery your recordset using the newly created query. This should work fine.

I hope I've helped you out...

Brettrb
Aug 10th, 1999, 11:58 AM
I am currently creating a code for my database that will create a query based upon selections from the database user and will sort all the entries accordingly. Since each time the user uses the code, the query changes with new entries from different fields in my tables, I was wondering if there is any way to call information from a query without specifically naming the source.

i.e. I need to create a report that will work for any choices the user makes. So the report must be able to pull information from the query without regard to whether the query has changed or not. Is there any way I can pull information from a specific column in the query without mentioning the actual name of the source? Or should I create a string from the user input and use it as the name that the query will create (link from the text box that the user inputted into to the report directly, so that it know the name of the query field as it is being created)?

Thanks for your assistance.