Link to home
Start Free TrialLog in
Avatar of jclothier
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.SelectionStart & "#)"

then I process the strSQL

Any help would be appreciated!
Avatar of PockyMaster
PockyMaster
Flag of Netherlands image

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

Avatar of jclothier
jclothier

ASKER

Hi Thanks for the reply. How would I code that?
ASKER CERTIFIED SOLUTION
Avatar of PockyMaster
PockyMaster
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks I'll try that and get back to you
Thanks That works. I made a slight change:

strsql = "INSERT INTO MyTable (MyDate) VALUES (#" & MonthCalendar1.SelectionStart.ToString("yyyy/MM/dd") & "#)"
ok, have fun coding!