By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

Insert current date using checkbox

P: 1
I am a newbie trying to learn Access from several books. I'm sure this is an easy one to answer..for someone, not me. Is it possible to insert a checkbox on a form which, when checked, inserts the current date into one of the fields in the form?

In Design View I put a checkbox alongside a field (Honorarium1).
I clicked to select it, then in its Properties I typed Honorarium1 as the Control Source.

When I clicked in the checkbox in form view 12/29/1899 appeared in the Honorarium field. huh??? I tried changing the Control Source to another field in the form and nothing came up when i tested it. I checked my underlying table and didn't have that odd date anywhere in in the table.

I'm also wondering if I can place checkboxes next to several other fields on the form as well. The form lists several milestones that occur at different dates and I want to avoid having to type the current date into each of them for each record. Same procedure?

Thank you. Joan
Aug 4 '07 #1
Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,615
You have (accidentally) posted this question in the Access Articles section. This is NOT an article.
I'm moving this to the main Access questions forum.

MODERATOR.
Aug 4 '07 #2

NeoPa
Expert Mod 15k+
P: 31,615
I am a newbie trying to learn Access from several books. I'm sure this is an easy one to answer..for someone, not me. Is it possible to insert a checkbox on a form which, when checked, inserts the current date into one of the fields in the form?

In Design View I put a checkbox alongside a field (Honorarium1).
I clicked to select it, then in its Properties I typed Honorarium1 as the Control Source.

When I clicked in the checkbox in form view 12/29/1899 appeared in the Honorarium field. huh??? I tried changing the Control Source to another field in the form and nothing came up when i tested it. I checked my underlying table and didn't have that odd date anywhere in in the table.

I'm also wondering if I can place checkboxes next to several other fields on the form as well. The form lists several milestones that occur at different dates and I want to avoid having to type the current date into each of them for each record. Same procedure?

Thank you. Joan
You can use a CheckBox if you like, but various other programmable events could also be used. A CheckBox is probably not the most appropriate in the circumstances, as unchecking it later wouldn't make much sense. What about using the Double-Click event of the control you're using to store the date field in? In the event property just have some code to say :
Expand|Select|Wrap|Line Numbers
  1. Me.[YourDateControl] = Date()
Aug 4 '07 #3

missinglinq
Expert 2.5K+
P: 3,532
NeoPa's suggestion is right on the money! Replacing YourDateField in the following code
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourDateField_DblClick(Cancel As Integer)
  2.   Me.YourDateField = Date()
  3. End Sub
  4.  
with the actual name of your date field will allow your users to assign the current date to the field by double-clicking on it. You can repeat this for as many fields as is necessary.

12/29/1899 is the date Access defaults to, if you will, when a non-date is assigned to a field whose datatype is defined as Date/Time.
I clicked to select it, then in its Properties I typed Honorarium1 as the Control Source.
This has assigned a date field Honorarium1 as the Control Source of a checkbox, which has a datatype of Yes/No, which is confusing Access. You need to go back into the Properties box and delete this.

Welcome to TheScripts, Joan!

Linq ;0)>
Aug 5 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.