InputBox to Pass Parameters to Queries

Dugantrain

I Love Pants
Local time
Today, 04:48
Joined
Mar 28, 2002
Messages
221
Hi all. I have a command button which, when clicked, deletes all records out of a table, appends 100's of 1000's of records from two different tables, selects records from this table based on a parameter query, and then runs a report. Everything works, but it's taking too much time with the Append Queries. What I'd like to do is to have Inputboxes in the On-Click event which will pass parameters to the Append Queries before they start appending so that I will only have to append a few 100 records rather than 200,000. Reading through the posts, I understand that I can make small, unbound forms that look like inputboxes which will perform exactly this task, but if I could just do it with inputboxes in VBA and then pass these parameters to the Append Queries, then I'd like to.

*I just thought of one way; I can have invisible unbound text boxes on the form, pass the input box string to them and then in turn pass those to the query. If anyone knows a better way though, then I'm still all ears.

*OK, that did it. My query went from taking over 2 minutes to running in less than 3 seconds. Sorry to take up space here, folks, but I'm sure this issue will help someone now or in the future.
 
Last edited:
The only other way is to collect the returned info from the InputBox using a user defined function:

Public Function Info1() as Variant
Info1 = InputBox("Prompt" etc)
End Function

This can then be returned as a parameter for a query by calling the Function in the criteria row:

Info1()
 

Users who are viewing this thread

Back
Top Bottom