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

FORMAT function not working

Status
Not open for further replies.

Jayson

Programmer
Jan 31, 2001
75
0
0
US
I have a pretty weird problem, i'm built an Access 97 application, with a whole bunch of forms, modules, queries etc...

Now, i'm using the function FORMAT (i.e. format(somedatestring, "yy-mmm-dd") to convert a string onto date format. Its works fine on most of my forms, but there some where it doesn't work at all. I know its not a syntax problem. For example:

Dim SomeDateString As String, TempVar As String
TempVar = Format(SomeDateString, "yy-mmm-dd")

This exact code works on some form, but doesn't on others.

I've declared "Option Compare Database" on top of my code, i dont know if that matters.

I also know "Intelli-Help" the help feature which autmatically comes up with how to use a recognize functions works only on some form , say if you type 'Format(', but other funtions like 'CStr(' works fine...

What could it be??? thanks for any suggestion!


 
I don't have an answer, just a suggestion of something to check.

Since you are passing in a string and not an actual date, have you checked to make sure that the "problem" forms are not being passed strings that cannot be converted to dates?

Michael
 
Thanks for you suggestion Michael!

The problem here is not really the conversion of string to date i think, but, its more like the actual function (i.e. Format function) doesn't work on certain forms, as i understand, correct me if i'm wrong, the function Format, takes in a string parameter, and outputs a string result, i think it doesn't actually convert the string to date datatype, just masking it to looking like a date.

I even went to a point where i hardcoded the 'string' date parameter on the function, to make sure that it is getting the right parameter, but the same problem.

I'm getting a feeling that this is more like a missing reference/object library problem.

Jayson
 

The CVdate function might be of use

format(cvdate(somedatestring, "yy-mmm-dd"))

regards

Jo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top