jclothier
asked on
Date Confusion
Hi All
I am having a problem with the MonthCalendar control. I have created a form which has the MonthCalendar control on it. the user then selects the required date and clicks the save button. The save button then writes this date into an Access Database field. All works fine if I pick say 25/10/2005 as a date, but when I select 02/03/2005 it saves the date as 03/02/2005 ?????
Here is a snippet of the code I use.
strSQL = "INSERT INTO MyTable (MyDate) VALUES (#" & MonthCalendar1.SelectionSt art & "#)"
then I process the strSQL
Any help would be appreciated!
I am having a problem with the MonthCalendar control. I have created a form which has the MonthCalendar control on it. the user then selects the required date and clicks the save button. The save button then writes this date into an Access Database field. All works fine if I pick say 25/10/2005 as a date, but when I select 02/03/2005 it saves the date as 03/02/2005 ?????
Here is a snippet of the code I use.
strSQL = "INSERT INTO MyTable (MyDate) VALUES (#" & MonthCalendar1.SelectionSt
then I process the strSQL
Any help would be appreciated!
Try to write the date in a non confusing format, e.g. yyyy/mm/dd or yyyy/mm/dd
I meant :yyyy/MM/dd or yyyy/MMM/dd
ASKER
Hi Thanks for the reply. How would I code that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks I'll try that and get back to you
ASKER
Thanks That works. I made a slight change:
strsql = "INSERT INTO MyTable (MyDate) VALUES (#" & MonthCalendar1.SelectionSt art.ToStri ng("yyyy/M M/dd") & "#)"
strsql = "INSERT INTO MyTable (MyDate) VALUES (#" & MonthCalendar1.SelectionSt
ok, have fun coding!