Open record randomily

fabioltj

Fabio Juliato
Local time
Today, 04:12
Joined
Sep 8, 2005
Messages
15
Hello,
I need your help or orientation to figure out how to control a randomily code to open a form/table record.

I have a table/form and I open the record randomily through this code:

record = DCount("[ID]", "FORM")
myvalue = (Int(record * Rnd) + 1)
DoCmd.OpenForm "FORM", , , "ID =" & myvalue


My challenge is:

1) I do not want that same record be opened more than one time a day.
2) Or the record does not be opened again until all records in the table have been opened.
3) The main point is, I can include new records during the day.

I appreciate your help.
 
you could alter the table the form is based on to include a date field which stores the date of the last time the record was opened.

you could then do:

DoCmd.OpenForm "FORM", , , "LastOpened < GetDate() AND ID =" & myvalue
 
Ozinm,
Fisrt of all, thank you.

I'm new in programming. So, I include the filed Data/Time, called GetData, in the Table.

I didn't understand the variable "LastOpened < GetDate()" .

1 - How can I store the date in that new field after I opened the record ?
2 - Which kind of variable is LastOpened ? I did not understand how it works.

Because, if I just include this line in my code, it simply does not work properly.

Thanks


Damn VIRUS !
 

Users who are viewing this thread

Back
Top Bottom