Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date and Stamp Check Box

Status
Not open for further replies.

msday

Technical User
Apr 12, 2001
6
US
I am relatively new to Access and need some help. Can someone tell me how to create a check box in a form that automatically enters the date/time the box is checked into its corresponding table?

Thanks for your help and patience,

Kathy
 
I assume you have a form with two controls. I'll call the checkbox control "chkBox" and the text box that will hold the date/time, "txtDate". You can set the "visible" property of txtDate to "true" while you work on the form and reset it later to "false", if you don't need the user of your application to see what is happening behind the screens. If you are trying to update a database table, then I'll assume that the "Control Source" property of txtDate contains the name of your database column.

You need to decide whether you also need to store the value of the checkbox in your database.

What should happen if the user checks the box, then unchecks it? Let's assume that you want to undo the update of the Date/Time...

Set chkBox property "After Update" to [Event Procedure] and click on the button that appears at the end of the property (it looks like it contains "...").

That should take you to the "code" form and you can then paste this code...

Private Sub chkBox_AfterUpdate()

If chkBox = True Then
txtDate = Now()
Else
docmd.RunCommand acCmdUndo
End If

End Sub

Jim Conrad
JimConrad@Consultant.com

 
Thanks Jim - I'll give this a try!

Kathy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top