Report Opens behind Form

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
 
A

Arvin Meyer

Change the popup property of the switchboard form to No.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Stefan said:
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
 
S

stefan

Pop up is set to no

-----Original Message-----
Change the popup property of the switchboard form to No.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Stefan said:
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


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.514 / Virus Database: 312 - Release Date: 8/28/2003


.
 

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