devxlogo

Changing Date Format

Changing Date Format

Question:
I am having trouble saving dates into an Access 1.1 DateTime field. The aplication I am writing is for the European market, so international dates are a problem as well.I am putting the current date into a Truegrid table as a string. When I try to convertit into a date I get Type Mismatch error. I get the same error if I try and save itto the database. Any advice would be most welcome. Thank you.

Answer:
Try this for converting string to date:

DateField = CVar(String)
For converting from date to string, try using the Format$ function like this:
String = Format$(DateField, “MM-DD-YY”)
Also be aware that your problems might lie with the codepage that your keyboard is set to. If you’re using a “US English” codepage and are trying to translate to a different (i.e. European) format it might be causing the type mismatch.

devx-admin

Share the Post: