I am using VBA in MICROSOFT ACCESS to write a record to a table.
My regional settings are "English South Africa",my short date is "dd/mm/yyyy" and my long date is "dd MMMM yyyy"
I have an auto date in the table (ie: default value = now() ) in a field called [autodate] and I am writing another date into a field called [mydate] to the table using an SQL statement.
If I type in "6/11/2001 11:32:45" as [mydate], the record saves with the following 2 dates.
[mydate] = "6/11/2001 11:32:45"
[autodate] = "11/6/2001 11:32:45" (month and day have swapped round)
There is nothing wrong with my code leading up to the SQL statement which is
DoCmd.RunSQL "INSERT INTO [Credits] ([mydate]) VALUES (#" & new_date & "#)"
If I use a break point and add a watch to the variable "new_date" I can see that it has the date with the day and month the right way around.
It only swaps it after it has been written to the table.
I have written a function that swaps the day and the month before writing it to the table but this is only a temporary solution. The way the screen works I have to use an SQL statement to write the record to the table.
Help would be much appreciated.
My regional settings are "English South Africa",my short date is "dd/mm/yyyy" and my long date is "dd MMMM yyyy"
I have an auto date in the table (ie: default value = now() ) in a field called [autodate] and I am writing another date into a field called [mydate] to the table using an SQL statement.
If I type in "6/11/2001 11:32:45" as [mydate], the record saves with the following 2 dates.
[mydate] = "6/11/2001 11:32:45"
[autodate] = "11/6/2001 11:32:45" (month and day have swapped round)
There is nothing wrong with my code leading up to the SQL statement which is
DoCmd.RunSQL "INSERT INTO [Credits] ([mydate]) VALUES (#" & new_date & "#)"
If I use a break point and add a watch to the variable "new_date" I can see that it has the date with the day and month the right way around.
It only swaps it after it has been written to the table.
I have written a function that swaps the day and the month before writing it to the table but this is only a temporary solution. The way the screen works I have to use an SQL statement to write the record to the table.
Help would be much appreciated.