Use a Text Box to query a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've built a form based on a query. I want to use that form to query for
multiple records (literally hundreds sometimes) for viewing and output to a
report. I prefer to have the user type in the values as opposed to selecting
them from a list. The list would be TOO long.

Thanks
 
Based on the info you provided, it sounds like you woul be better off using a
combo box with a query as it's row source. Even though the initial list might
be very long, as soon as your users start entering data in the combo box it
will automatically move to records that match what they have started typing
 
Thanks Beetle.
I had already tried that. With that I get a list and that's not what I
want. I want a text box where you can copy and paste the search criteria,
e.g., 153004 or 165000 or 20001 or ....etc. Selecting from a list is too,
too laborious with several thousand part numbers.
 
Thanks Beetle.
I had already tried that. With that I get a list and that's not what I
want. I want a text box where you can copy and paste the search criteria,
e.g., 153004 or 165000 or 20001 or ....etc. Selecting from a list is too,
too laborious with several thousand part numbers.

And typing scores of five or six digit numbers *isn't*!?

Where would the list values come from?

To do this using a textbox you will need to have VBA code to extract the list
of values (I'd suggest as comma separated text if possible) and construct the
SQL of a query using the IN() syntax:

WHERE PartNo IN("153004", "165000", "20001", ...)

This can't be done easily using a parameter query.

John W. Vinson [MVP]
 
Thanks John, tha's probably the easier way to address the need. I finally
ended up setting up an empty table that I joined to the query and then built
a macro to transfer the text from the text file to the table and query the
database. It works, just might not be the most efficient way to do it.
 
Thanks John, tha's probably the easier way to address the need. I finally
ended up setting up an empty table that I joined to the query and then built
a macro to transfer the text from the text file to the table and query the
database. It works, just might not be the most efficient way to do it.

If the table is properly indexed, that may indeed be the best way! If it's
working for you, go with it.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top