Connecting a Check Box with a date Field?

J

JR

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 ??
 
J

Jeff Boyce

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>
 
J

JR

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.
 
J

Jeff Boyce

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>
 
J

JR

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
 
J

Jeff Boyce

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>
 

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