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.
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.