timestamp from a command button

G

Guest

Hi,

Hopefully a very simply one. Basically i have a command button on an Access
form i would like the data and time ( Now() ) to display in a text box or
preferably a label on the form which marks when the button was last clicked,
and to remain until its clicked again when its updated, etc...

Thanks
 
G

Guest

Thank you that works fine, however when the form is closed and re-opened the
date disappear and the label is blank. Is there anyway that this date can
remain until the button is clicked again
 
R

Rick Brandt

sdg8481 said:
Thank you that works fine, however when the form is closed and
re-opened the date disappear and the label is blank. Is there anyway
that this date can remain until the button is clicked again

If you want it to persist then you need to store it in a table. Then you can
retrieve it from that table when the form opens.
 
J

Jeff Boyce

Another approach, if you want the date/time stamp ONLY to appear on the form
(and not, as Rick points out, stored in a table), you can set the default
value of a textbox control in a similar manner to my earlier suggestion (you
WON'T use the caption property).

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/
 
R

Rick Brandt

Jeff said:
Another approach, if you want the date/time stamp ONLY to appear on
the form (and not, as Rick points out, stored in a table), you can
set the default value of a textbox control in a similar manner to my
earlier suggestion (you WON'T use the caption property).

But wouldn't that require opening the form in design mode for it to "stick"?
And wouldn't that also mean that the OP would be stuck with an MDB and would
not able to use an MDE?
 
J

Jeff Boyce

I suspect you're right about the MDE.

I seem to recall being able to, in code, change the default value of a
control. For example, one way to make a "sticky" value in a form is to
reset the DefaultValue property as you save the current record.

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/
 
R

Rick Brandt

Jeff said:
I suspect you're right about the MDE.

I seem to recall being able to, in code, change the default value of a
control. For example, one way to make a "sticky" value in a form is
to reset the DefaultValue property as you save the current record.

Unless that is something that changed in the newer versions such a change
would only "stick" until you closed the form. Then it would revert to the
default value property set when the form was built.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top