How do I create a button in Access that, when clicked, automatica.

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

Guest

I would like to make a command button, actually 3 beside a field, that when I
click the button, it automatically inserts today's date into the field beside
it. I am stuck when it comes to that and I would like to know. Thank You
 
Add the following code, with appropriate names, in the Click event of your
button.

Me.txtYourTextField = Date()
 
I would like to make a command button, actually 3 beside a field, that when I
click the button, it automatically inserts today's date into the field beside
it. I am stuck when it comes to that and I would like to know. Thank You

Put the following code into the button's Click event. Click the ...
icon by the Click property on the Events tab in the command button's
properties, and invoke the Code Builder:

Private Sub cmdDate1_Click()
Me!txtDate1 = Date
End Sub

Perhaps even easier (though it involves some user training) is to put
the same line of code in txtDate1's DoubleClick event; the user can
simply doubleclick in the textbox to get today's date entered. Easier
yet (on you, not the user) - teach them that ctrl-; will enter the
date automatically.


John W. Vinson[MVP]
 
Back
Top