If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
"Top Values=X" where "X" is passed from form to the Query Property
I have a query that I am using to randomly select employees from our employee
database for drug screening, and would like to allow the manager to make the selection from a button on a form. I know how to create the form, etc, the problem I am having is that I want the manager to be able to provide the number of employees to randomly select at runtime (without having to modify the query each time.) So....how can I pass a value that the manager inputs on a form at runtime to the query property "Top Values" ? The field in query properties will not allow me to type in a formula, only an integer value. Thanks ! |
#2
|
|||
|
|||
You will need code to modify the SQL String of the Query as in "Top X", "X"
cannot be a Parameter (AFAIK). Create the QueryDef object (think of it as the Query in code) and modify its SQL String to the suitable X so that in the resultant SQL, X becomes explicit. Close the QueryDef (which will save the Query with the modified SQL) and then run the Query by code. -- HTH Van T. Dinh MVP (Access) Eric @ SEASH; "Evansville" wrote in message ... I have a query that I am using to randomly select employees from our employee database for drug screening, and would like to allow the manager to make the selection from a button on a form. I know how to create the form, etc, the problem I am having is that I want the manager to be able to provide the number of employees to randomly select at runtime (without having to modify the query each time.) So....how can I pass a value that the manager inputs on a form at runtime to the query property "Top Values" ? The field in query properties will not allow me to type in a formula, only an integer value. Thanks ! |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Need to clear controls of Filter form | Jan Il | Using Forms | 2 | November 28th, 2004 03:04 PM |
open a form through a subform in access 2000 | Tammy | Setting Up & Running Reports | 12 | October 22nd, 2004 02:43 PM |
dlookup | miaplacidus | Using Forms | 9 | August 5th, 2004 09:16 PM |
auto entry into second table after update | Tony | New Users | 13 | July 9th, 2004 10:42 PM |
synchronizing form and list box | Deb Smith | Using Forms | 8 | June 21st, 2004 08:15 PM |