Connecting a Check Box with a date Field?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to connect a check box, so when I put a check in it, it
automatically fields in the date with the current date ??
 
JR

Tables store data, forms display it.

NOTE: the following is predicated on the assumption that you are using a
form for data entry. Your ARE using a form, right?!

In the checkbox's AfterUpdate event, add code to "push" the current date
into the date control. If you only need the date, use Date() ... if you
need date & time, use Now().

Good luck

Jeff Boyce
<Access MVP>
 
I am using a form to enter the data, I'm kind of new to this adding code and
I'm not sure about the "Push" code. Thanks for your help.
 
JR

"push" is just a jeff-ism. You will need to create a procedure in the
AfterUpdate event. Your code will look something like:

If Me!chkYourCheckBox = True Then
Me!txtYourTextControl = Date()
End If

Good luck

Jeff Boyce
<Access MVP>
 
Jeff,
Thanks for your help and patience, I put in

If Terminate_Access = True Then
Terminated_Date = Date

It want let me add the () and returns a run timw erro 438(Object doesn't
support this property or method. What did I do wrong??


End If
 
JR

Don't sweat the () after Date() -- Access usually throws that away.

The code in your post didn't have any

End If

Does the code in your procedure have this?

The error message you received implies that Access is mis-interpreting the
names of the fields you are giving it. To avoid ambiguity, you might want
to rename the controls something other than the name of the field that the
control holds. That's why I was using "chkYourControlName" (for a checkbox)
and "txtYourDateControl" (for a textbox).

Good luck

Jeff Boyce
<Access MVP>
 
Back
Top