E
Elaine
Hi guys,
I'm having some problems with date formatting.
Background:
- My system regional settings is set to UK system
- Location is set to United Kingdom
- All my dates in my Access tables are formatted as "dd/mm/yyyy"
- MS Windows XP SP2
- MS Access 2003
I have a table called tblSemester with the following information:
Field names: Semester, semStartDate, semEndDate
Sample data: S10506,01/10/2005,27/01/2006
S20506,28/01/2006,09/06/2006
Summer0506,10/06/2006,30/09/2006
S10607,01/10/2006,29/01/2007
S20607,30/01/07,02/06/2007
I have the following function:
************************
Public Function setSemester() As String
Dim varCriteria As String
varCriteria = "[semStart] <= #" & Format(Date, "dd/mm/yyyy") & "# AND
[semEnd] >= #" & Format(Date, "dd/mm/yyyy") & "#"
varSemester = DLookup("[Semester]", "tblSemester", varCriteria)
setSemester = varSemester
End Function
***************************
And finally, I have a form with one control, txtSemester, where the Default
value is set to "setSemester"
My problem is:
the result of the function is always wrong as it assumes the date is in the
American format.
For example, if today's date is 09/05/2006 (9 May 2006), the function will
return "Summer0506"(as would be expected if today's date were 05/Sept/2006),
instead of "S20506" as it should.
Could you please let me know where else in the system I should set the
location to UK, or any other way to work around this problem.
Let me know if you need other details.
Many many thanks,
Elaine
I'm having some problems with date formatting.
Background:
- My system regional settings is set to UK system
- Location is set to United Kingdom
- All my dates in my Access tables are formatted as "dd/mm/yyyy"
- MS Windows XP SP2
- MS Access 2003
I have a table called tblSemester with the following information:
Field names: Semester, semStartDate, semEndDate
Sample data: S10506,01/10/2005,27/01/2006
S20506,28/01/2006,09/06/2006
Summer0506,10/06/2006,30/09/2006
S10607,01/10/2006,29/01/2007
S20607,30/01/07,02/06/2007
I have the following function:
************************
Public Function setSemester() As String
Dim varCriteria As String
varCriteria = "[semStart] <= #" & Format(Date, "dd/mm/yyyy") & "# AND
[semEnd] >= #" & Format(Date, "dd/mm/yyyy") & "#"
varSemester = DLookup("[Semester]", "tblSemester", varCriteria)
setSemester = varSemester
End Function
***************************
And finally, I have a form with one control, txtSemester, where the Default
value is set to "setSemester"
My problem is:
the result of the function is always wrong as it assumes the date is in the
American format.
For example, if today's date is 09/05/2006 (9 May 2006), the function will
return "Summer0506"(as would be expected if today's date were 05/Sept/2006),
instead of "S20506" as it should.
Could you please let me know where else in the system I should set the
location to UK, or any other way to work around this problem.
Let me know if you need other details.
Many many thanks,
Elaine