Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Function Related

Status
Not open for further replies.

UmaGrama

Technical User
Sep 8, 2003
33
BR
Hi...

I am trying to get the system clock to inform me the date but I am having trouble with such a simple task. You may be thinking, "just click on Insert and then Date/Time". Yeah, that is what I did though for some reason it gives me #None? where it should had been the date/time.

I tried doing it by code:

Dim myTime
myTime = Date

Why doesnt any of these work??? :?

 
Normally, all you have to do is add a text box with a control source of
=Date()


Duane
MS Access MVP
 
The system variable NOW() contains the current RTC timestamp, e.g. 11/05/2003 12:45:15, down to the second.

Assigning that variable to a field should be straigtforward:

MyTime = Now()

Make sure you don't have a FIELD that you inadvertantly named DATE..that could be where your confusion lies.

Oh, and another thing - you might want to make sure you explicitly type your DIM'ed variables:

Dim MyTime as Date
MyTime = Date()


Jim

If at first you don't succeed, skydiving probably isn't for you!
Another free Access forum:
More Access stuff at
 
Yes... the NOW() function works perfectly though I dont want to get the time with it.

The Date() thing still doesnt work. Look what I simply wrote:

Dim t As Date
t = Date

I tried putting the parenthisis on it but once I push Enter it disappears.

When I compile it, it says library not found. Weird!
 
Actually, not. Your last line is the key. Sometimes, the library with all the DATE and FORMAT function and other misc. bits of Access gets disconnected. You need to enter the module (vba) editor, hit TOOLS/REFERENCES, and notice one that is MISSING - possible the Access 10.0 object library, or another one, depending on your version. You need to BROWSE over and find that guy and 're-link' him, so to speak. This happens every now and then, a library reference gets blown away and simple things like DATE() no longer work...

Jim

If at first you don't succeed, skydiving probably isn't for you!
Another free Access forum:
More Access stuff at
 
Shouldn't that have been:

Dim t As Date
t = Date()

or was it just a typo on your part?

Gunny

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top