Automatically insert date when other field is true?

K

KLP34

I have a date field and a yes/no field. Is it possible to have the program
insert the current date when the yes/no field is checked?
 
S

Stuart McCall

KLP34 said:
I have a date field and a yes/no field. Is it possible to have the program
insert the current date when the yes/no field is checked?

Insert the following code into the checkbox's AfterUpdate event procedure:

If Me.checkBox = True Then Me.txtDate = Date()
 
M

Mike Painter

Stuart said:
Insert the following code into the checkbox's AfterUpdate event
procedure:
If Me.checkBox = True Then
Me.txtDate = Date()
else
Me.date = ...
' NULL or a date far in the future are options.
End if
Without the "else" the date will remain even if you uncheck the other field.
 

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