A date is not just a date!

K

Kagsy

Hiya Buddies,

I live in the UK and my control panel is set at English
(UK). I have a real problem with the way Access/Windows
converts to the mm/dd/yy of the American format. Do I add
a date at the UK style and then have to force it at the
end to the correct format. I am working with a server and
a pc. Could the server be set at US format or is this the
normal way?

When I run the code below I set the curDate variable as
#1/4/2004#, it will turn it to #4/1/2004#. I am just
totally confused. My system then reads it as the 4th Jan
if I run the datediff function.

Please help me guys...

I have added the code below for help. Thanks...

Kagsy


Private Sub checkDailyIncDateXport()
Dim i As Integer
Dim startDate As Date
Dim endDate As Date
Dim curDate As Date
startDate = #1/4/2004#
endDate = Date - 1
curDate = #1/4/2004#
i = 1
Do Until curDate >= endDate
For i = 1 To 11
Call updateForm(SiteID, curDate)
Next i
curDate = curDate + 1
Loop
End Sub

Private Sub updateForm(siteName As String, selDate As Date)
Dim frm As Form
Set frm = Forms!frmDailyIncExtract
frm!cboSite = siteName
frm!txtIncDate = Format(selDate, "DD/MM/yyyy")
Set frm = Nothing
End Sub
 
R

Roger Whitehead

Has your PC got the latest MS Updates? A similar problem in Word
(incorrectly converting dates from External Data Sources) appears to have
been addressed in the last few weeks.

Just a thought....
 
R

Roger Carlson

The Access interface (forms, queries, and such) will respond to your Local
Settings. However VBA *will not*. It is perpetually stuck in US format.
You should always format your dates as US format in code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top