Still working on Buttons

D

DaveB

I finally Got my buttons on the Form, but they don't work
right. In the table that refers to the field I selected
General Date/Time, but when I click on my button
expecting the Date and Time I get just the Date. When I
click on one of the buttons I get an error message from
the office assistant: "Unable to open time. Cannot open
the specified file." How can I fix it so I can view both
the date and the time?
 
M

Michel Walsh

Hi,


Date( ) will return today date, Now( ) will return today date and
actual time.

Format( ) can be use to "display" what is already stored.

Format( Now(), "mm-dd-yyyy") would display only the date, even if
Now( ) knows about the time;

Format( Now(), "mm-dd-yyyy hh:nn:ss") would display the date and the
time,

Format( Now(), "hh:nn") would display just the hour and the minute.


So, basically, you are in charge of what is displayed... Exactly how, or
where you did it, is nearly impossible to tell from your description, but if
you want to store the actual date_time in a field TheDateField, which
correspond to the control TheDateControl, when you click on the form button
TheDateButton, I would type, under the TheDateButton Click event:


Me.TheDateControl = Now( )


and would take a look at the FORMAT I have specified for that control, to be
sure I display not just the date, but the time too. And that should do it,
without no more any code to add.



Hoping it may help,
Vanderghast, Access MVP
 

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