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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem With Date Functon

Status
Not open for further replies.

dpimental

Programmer
Jul 23, 2002
535
US
I am trying to call the standard Date(); but every time I use it, the Form Module errors out saying it can't find that field.

Do i need to use it in a Global Module?

David I'm Your Huckleberry!
 
Give us more details. How are you using it? If you put it in a recordsource without the parentheses '=Date' then Access will put brackets around it and assume it's a field name '=[Date]'

Are you using it in code?
VBSlammer
redinvader3walking.gif
 
I am using it this way.

mydate = date

I type it this way "Date()"
but it changes the "D" to lower case and removes the "()".

David I'm Your Huckleberry!
 
It sounds like you have a global variable or a field named 'date' somewhere in your project which is causing an ambiguous reference. I've done that before and once I confused VB by using the reserved word as a variable, it wouldn't straighten out even after I deleted the variable.

Have you tried to compile the program to see if it will pinpoint what is making it angry?

As a last resort you could use:

Code:
myDate = Format(Now, "mm/dd/yy")

Sometimes this kind of behavior is caused by a missing reference. Open your references window and check to see if the word "MISSING" is next to any of your references.



VBSlammer
redinvader3walking.gif
 
Try using the cdate()function. Example: cdate("10/11/2002") This is a safe to use function for date validation and proper format when writing to an Access or SQL date field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top