View Full Version : Selecting random weeks of the year


drisconsult
10-19-2007, 04:15 AM
Hello All

I have a number of Select queries that select 1st quarter up to 4th quarter of the year for accounting purposes. These are quite simple queries such as:

between "10" and "24" entered in the Criteria window. 10 and 24 being week numbers.

However if I wish to randomly select the week numbers after the query is loaded what is the correct code?

Regards
Terence
London

Guus2005
10-19-2007, 06:14 AM
SELECT *
FROM Table1
WHERE (((Table1.Weeknr)=CInt(52*Rnd(Now()))));
Enjoy!

drisconsult
10-19-2007, 09:34 AM
Hello Guss2005

When the user loads the query, the "Enter Parameter Vaue" dialog box opens and the user will be expected to enter the required week numbers.

Where do I enter the code?

Guus2005
10-20-2007, 06:47 AM
Not sure what you mean by "the code".

Please post your query without any asterisks (*).
You should have to enter any parameters.