Untick yes/no field

M

Manton

Hi.
I'd like to know if after the records have been ticked , whether one can
then have those same records unticked - in case a mistake had been made the
first time to tick them.
----------------------
Assuming your table has a numeric primary key named "ID", you can get 170
random records in the date range with this kind of thing:
SELECT TOP 170 * FROM [tbl_data entry]
WHERE [Enquiry Date] Between #1/31/2004# And #2/29/2004#
ORDER BY Rnd([ID]), ID;
You can then turn it into an Update query (Update on query menu) to update
the Free field to True.
 
D

Douglas J. Steele

To untick them, use an Update query to set the field to False.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Manton said:
Hi.
I'd like to know if after the records have been ticked , whether one can
then have those same records unticked - in case a mistake had been made the
first time to tick them.
----------------------
Assuming your table has a numeric primary key named "ID", you can get 170
random records in the date range with this kind of thing:
SELECT TOP 170 * FROM [tbl_data entry]
WHERE [Enquiry Date] Between #1/31/2004# And #2/29/2004#
ORDER BY Rnd([ID]), ID;
You can then turn it into an Update query (Update on query menu) to update
the Free field to True.
Notes:
1. Issue a Randomize in the Immediate Window Ctrl+G) before running the query.

2. The Rnd() function does not do anything with the ID field, but if you do
not pass in a changing number, the optimizer does not call the Rnd()
function on every row.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Manton said:
Access 2000.
I have a field in a table (tbl_data entry) which has a field called Free and
another field called SD (containing 2 options: 5 and 6)
The Free field is a yes/no format.
I'd like to run a query which upon entering a date range ("Enquiry Date")
value -allows the query to choose 170 records (by ticking off the yes/no
field "Free") randomly from tbl_data entry.
Alternatively: It could choose (ticking off the yes/no field "Free) the
first 170 records within the date range entered (choosing the earliest date
and working down the list).
thanks.
 

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

Top