G
Guest
Sorry to post again so soon but I'm now battling with trying to get a date
into UK format (dd/mm/yyyy).
Below is the code for the GetStartDate function that is called in a number
of queries as 'Between GetStartDate(x) And GetEndDate(x):
Public datStart As Date
Public datEnd As Date
Public x As Integer
Public y As Integer
Public Function GetStartDate(x As Integer) As Date 'the beginning date used
in most of the queries
If x = 1 Then
datStart = #1/4/2004# 'summer 04
ElseIf x = 2 Then
datStart = #1/1/2005# 'january 05
ElseIf x = 9 Then
x = y
If x = 1 Then
datStart = #1/4/2004# 'summer 04
ElseIf x = 2 Then
datStart = #1/1/2005# 'january 05
End If
End If
GetStartDate = Format(datStart, "dd/mm/yyyy")
End Function
The GetEndDate function is obviously very similar.
I've tried using FormatDateTime in the function -eg, 'datStart =
FormatDateTime("01/04/2004", vbShortDate) and it's still returning records
from 4th January instead of 1st April. How can I get this to change guys?
I've checked my Regional Settings and they're definitely in UK format.
I do hope you can help me out!
Kind regards,
Lee
into UK format (dd/mm/yyyy).
Below is the code for the GetStartDate function that is called in a number
of queries as 'Between GetStartDate(x) And GetEndDate(x):
Public datStart As Date
Public datEnd As Date
Public x As Integer
Public y As Integer
Public Function GetStartDate(x As Integer) As Date 'the beginning date used
in most of the queries
If x = 1 Then
datStart = #1/4/2004# 'summer 04
ElseIf x = 2 Then
datStart = #1/1/2005# 'january 05
ElseIf x = 9 Then
x = y
If x = 1 Then
datStart = #1/4/2004# 'summer 04
ElseIf x = 2 Then
datStart = #1/1/2005# 'january 05
End If
End If
GetStartDate = Format(datStart, "dd/mm/yyyy")
End Function
The GetEndDate function is obviously very similar.
I've tried using FormatDateTime in the function -eg, 'datStart =
FormatDateTime("01/04/2004", vbShortDate) and it's still returning records
from 4th January instead of 1st April. How can I get this to change guys?
I've checked my Regional Settings and they're definitely in UK format.
I do hope you can help me out!
Kind regards,
Lee