A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

"Top Values=X" where "X" is passed from form to the Query Property



 
 
Thread Tools Display Modes
  #1  
Old May 19th, 2005, 10:02 PM
Eric @ SEASH, Evansville
external usenet poster
 
Posts: n/a
Default "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  
Old May 19th, 2005, 11:46 PM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 02:37 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.