International dates

  • Thread starter Thread starter Saylindara
  • Start date Start date
S

Saylindara

I have set up a parameter form to open a report.
I originally set up two textboxes - a DateFrom and DateTo. The format for
these is dd mm yyyy. Unfortunately the report opens as though I had requested
the dates in the American format mm dd yyyy, e.g. a date requested from 3rd
April opened a report from 4th March. Short date or long date it didn’t make
any difference.

The instructions for using a calendar said that this would solve the problem
but it didn’t. I also tried a module for converting the date to the US
format, Format() and CVDate, but nothing worked.

The codes I used to open the report and the calendar are as follows:

On Click Event of the command button to open the report

Private Sub Command10_Click()
Refresh
If IsNull(cboFindEvent) Then
DoCmd.OpenReport "r_EventsAttendedByEvent", acViewPreview, , "EventDate >=
#" & Me.cboEventFromDate & " # AND " & "EventDate <= #" & Me.cboEventToDate &
"#"
Else
DoCmd.OpenReport "r_EventsAttendedByEvent", acViewPreview, , "EventID =" &
Me.cboFindEvent & " AND " & "EventDate >= #" & Me.cboEventFromDate & " # AND
" & "EventDate <= #" & Me.cboEventToDate & "#"
End If
End Sub

The Calendar

The selection boxes for the calendar are comboboxes so people know they have
to click on them. The calendar pops up and then once the date is selected it
disappears.

Private Sub cboEventToDate_MouseDown(Button As Integer, Shift As Integer, x
As Single, Y As Single)
Refresh
ocxCalendarEventTo.Visible = True
ocxCalendarEventTo.SetFocus
If Not IsNull(cboEventToDate) Then
ocxCalendarEventTo.Value = cboEventToDate
Else
ocxCalendarEventTo.Value = Date
End If
End Sub

And

Private Sub ocxCalendarEventTo_Click()
cboEventToDate = ocxCalendarEventTo.Value
cboEventToDate.SetFocus
ocxCalendarEventTo.Visible = False
End Sub

Any help gratefully received.
 
Thank you for your reply.

I found Allen Browne's advice helpful when I working out queries involving
dates. I used CVDate then. The trouble is, being a numbskull, I only
understand very simple instructions. I couldn't open the database on your
link but I've studied the pdf. I don't know what a wrapper is. Is it the same
as a module? The SQLDate thingy looks just the ticket if I can use it to open
the report. Will it mean that the users can put in the date in the British
format in the text box on the unbound parameter form and all will be OK?
 
When I refer to a "wrapper function", I'm simply talking about a function
that has to be wrapped around a value or expression. The function itself
would exist in a module.

I'm curious as to why you couldn't open the database. It's in Access 97
format, and all current versions of Access should be able at least to open
it.
 
That's absolutely brilliant, thank you very much. I've been opening and
closing reports for the sheer pleasure of seeing it work. Poetry in motion.

I don't know why I couldn't open the database. I expect I was doing it wrong.

One other thing. For the past few weeks I have been having a lot of trouble
posting on this site. I keep getting "Service temporarily unavailable". I've
tried from home and work and it's the same. Is it me or is this a problem
with everyone at the moment?
 
Back
Top