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

Problem with opening A2K Form using date as link fields

Status
Not open for further replies.

mshone

Technical User
Jun 10, 2000
6
AE
I'd be most greatful as this is driving me crazy. I have even tried using A97 and XP were this Database form works fine but not so for A2000.

The Problem: I have created a form to select a date and then click a button to open the relevant record in the one and only table. However, when the form based on that table opens the date selected has been screwed up. E.G. If I select the date as 13/08/02 (dd/mm/yy) then the table form opens with a date of 2nd Aug 2013. the date field in the table is my primary key and is unique.

Can anyone help?????? I'm going mad!
 
The default regional settings on your machine may be the source of your 'madness'...
Get the Form, Table and function that returns a date to use the same format (Short Date).

On your form, ensure the Format of the control displaying the date is Short Date via Properties, Format, Format property.

Ensure the primary key date field on your table has data type of date/time and format = Short Date

And most importantly (suspect your problem lies here), ensure the date value you retrieve from and then store into table is formatted as date/time, NOT just a field in a valid date (dd/mm/yy) format. Use VB FormatDateTime function, i.e.
Code:
debug.Print FormatDateTime("13-Aug-2002",vbShortDate)
debug.Print FormatDateTime("13-August-2002",vbShortDate)
debug.Print FormatDateTime("13/08/2002",vbShortDate)
debug.Print FormatDateTime("13-08-02",vbShortDate)
debug.Print FormatDateTime("2002/08/13",vbShortDate)
all return "13/08/02" as an expression formatted as a date.

Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top