Full Version: On Click
UtterAccess Forums > Microsoft® Access > Access Date + Time
Hello everyone
I have a command button named Todays Date
And a text box in form (unbound) named Edate
I would like to write the code that on click
would replace the content of the Edate text box (if there is already anything in it) to the current todays date.
Edate properties <- this is the unbound text box
Name: Edate
Format: dd-mmm-yy
Input Mask: 00\->L<LL\-00;0;_
Command button properties
Name: Todays Date
Thank you ( if any one has could guide me to a place to find answers to these simple questions so i dont bother you guys, that would be great also) P.S i asked for some access books for christmas lol)
On the command button's OnClick event put
e.Edate = Date()
I must be doing somethig wrong. That is what i thought it was, and that is what i have already done.
Thank you so much for your help anyways.
One more question.
would the code change any if the Edate text box was bound?
It depends. If the field it was bound to was a datetime then it would stay the same. If the field was text, you may have to coerce it to a string.
aaah, i see
it is a date time but it's input mask is 00\->L<LL\-00;0;_
resulting in a text of 22-Nov-06 (that would be considered text right?)
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.