Full Version: On Click
UtterAccess Forums > Microsoft® Access > Access Date + Time
User4Fun
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)
niesz
On the command button's OnClick event put
e.Edate = Date()
User4Fun
I must be doing somethig wrong. That is what i thought it was, and that is what i have already done.
HMMMMMM.....
Thank you so much for your help anyways.
User4Fun
One more question.
would the code change any if the Edate text box was bound?
niesz
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.
User4Fun
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.