S
Stefan
I am opening a report from a switchboard.
From the switchboard I click on the report name which
opens up a criteria form. When the report opens the
criteria form should close but the switchboard should stay
open and report should open on top of the switchboard.
With the code I am using the report opens but behind the
switchboard. If I leave the last DoCmd statement that
closes the criteria form out of the code the report opens
correctly but the criteria form remains. If I close the
criteria before the report opens I lose the criteria.
I have used this code in other forms with no problem the
only difference is that I had the report was created by
the wizard not from design view.
Any help will be greatly appreciated.
I am using the following code to open the report
strReport = "rpt_FacilityReport"
strField = "[Date From]"
If IsNull(Me.txtstartdate) Then
If Not IsNull(Me.txtenddate) Then 'End date, but
no start.
strWhere = strField & " < " & Format
(Me.txtenddate, conDateFormat)
End If
Else
If IsNull(Me.txtenddate) Then 'Start date,
but no End.
strWhere = strField & " > " & Format
(Me.txtstartdate, conDateFormat)
Else 'Both start
and end dates.
strWhere = strField & " Between " & Format
(Me.txtstartdate, conDateFormat) _
& " And " & Format(Me.txtenddate,
conDateFormat)
End If
End If
' Debug.Print strWhere 'For
debugging purposes only.
DoCmd.OpenReport strReport, acViewPreview, , strWhere,
acWindowNormal
DoCmd.Close acForm, "frm_FacilityReport", acSaveNo
From the switchboard I click on the report name which
opens up a criteria form. When the report opens the
criteria form should close but the switchboard should stay
open and report should open on top of the switchboard.
With the code I am using the report opens but behind the
switchboard. If I leave the last DoCmd statement that
closes the criteria form out of the code the report opens
correctly but the criteria form remains. If I close the
criteria before the report opens I lose the criteria.
I have used this code in other forms with no problem the
only difference is that I had the report was created by
the wizard not from design view.
Any help will be greatly appreciated.
I am using the following code to open the report
strReport = "rpt_FacilityReport"
strField = "[Date From]"
If IsNull(Me.txtstartdate) Then
If Not IsNull(Me.txtenddate) Then 'End date, but
no start.
strWhere = strField & " < " & Format
(Me.txtenddate, conDateFormat)
End If
Else
If IsNull(Me.txtenddate) Then 'Start date,
but no End.
strWhere = strField & " > " & Format
(Me.txtstartdate, conDateFormat)
Else 'Both start
and end dates.
strWhere = strField & " Between " & Format
(Me.txtstartdate, conDateFormat) _
& " And " & Format(Me.txtenddate,
conDateFormat)
End If
End If
' Debug.Print strWhere 'For
debugging purposes only.
DoCmd.OpenReport strReport, acViewPreview, , strWhere,
acWindowNormal
DoCmd.Close acForm, "frm_FacilityReport", acSaveNo