Command button inserting =Now() into field

  • Thread starter Thread starter Drew Shriner
  • Start date Start date
D

Drew Shriner

Is there any way to have a command button beside a field
in a form, so that the user can just click the command
button, and the current time & date is entered into the
field beside it?

For example, I have a table, and form, with the following:

[Event_Registrations]
RegID PK
EventID
RegistrationDate
CancelDate
CheckedIn
CheckedOut
etc...

As I said, those fields are in the [Event_Registrations]
table, and I have a form by a similar name. It would be
terribly convenient, if an attendee wanted to check out
quickly, if the database user could simply open the
correct form, and click the command button beside
the "CheckedOut" field.

I apologize if I wasn't clear enough (or too long winded),
I can be more-so in either way... :)

Thanks!

Drew
 
-----Original Message-----
Is there any way to have a command button beside a field
in a form, so that the user can just click the command
button, and the current time & date is entered into the
field beside it?

For example, I have a table, and form, with the following:

[Event_Registrations]
RegID PK
EventID
RegistrationDate
CancelDate
CheckedIn
CheckedOut
etc...

As I said, those fields are in the [Event_Registrations]
table, and I have a form by a similar name. It would be
terribly convenient, if an attendee wanted to check out
quickly, if the database user could simply open the
correct form, and click the command button beside
the "CheckedOut" field.

I apologize if I wasn't clear enough (or too long winded),
I can be more-so in either way... :)

Thanks!

Drew
.
you were very clear, drew. yes, it can be done as you
describe.
open the form in design view.
create a command button beside the control as you
described.
select the command button (still in design view).
open the Properties box, click the Events tab and scroll
to the On Click event line.
double click in that line. the words [Event Procedure]
will appear.
click the ellipsis (...) button at the right, which will
take you to the form's module.
you'll see the following:

Private Sub Command0_Click()

End Sub

enter the following command in the procedure, as

Private Sub Command0_Click()
Me!CheckedOut = Now
End Sub

that should do it. if i gave more detailed instructions
than you need, sorry.
 
-----Original Message-----
Thanks! It worked flawlessly... I had done things exactly
like it a million times... so now I'm wondering why in the
world I didn't take 2 seconds to stop and remember how to
do it.

Thanks again!

Drew
lol. welcome to my world! :-)
 
Back
Top