Automating an update depending.....

pdbowling

Registered User.
Local time
Today, 19:57
Joined
Feb 14, 2003
Messages
179
Morning everyone.
Tis doesn't seem too difficult, but as with most of my Access issues, I just don't know the syntax or what keywords to search on.

I have two fields I'm working with (many more in dbase). One is a date and the other is a text field with yes/no (should have been a y/n field but I didn't build it).

What I'd like to do is in the OnOpen event for my form, step through the database looking at the date and if the date is less than today then change the yes/no field to yes.

if [dateField] < now() then [Expired] = 'Yes'

Something like this...

Any suggestions??
PB
 
I would use a query like this,

'update Mytable set Expired = 'Yes' where dateField < now'

jus run the query and watch all those expired's change to yes if required

Here is a line of code u can use to do the job.....

currentproject.connection.execute "update Mytable set Expired = 'Yes' where dateField < now"


:cool: ShadeZ:cool:
 
Last edited:
Why not just create an update query and run it prior to opening the form. It will most likely be quicker also.
 

Users who are viewing this thread

Back
Top Bottom