Results 1 to 4 of 4
  1. #1
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276

    Report Opens Behind The Open Form - help needed to fix this problem

    I have a form "DialogSupPur" with A button to open report "PurSupRpt1" when the reoprt opens it does not open in front of form instead it opens behind a form "SWITCHBOARD" whereas all other forms and reports are working fine with the similar conditions.
    the following code is used to open the report.

    Private Sub SupPurBtn_Click()
    On Error GoTo Err_Handler

    Const ReportName = "PurSupRpt1"
    Const MESSAGETEXT = "No Item Selected."
    Dim strCriteria As String

    ' build string expression to filter report

    strCriteria = "[SupervisePLogin By] = """ & Me.CboSupPur & """"



    If Not IsNull(Me.CboSupPur) Then
    DoCmd.OpenReport ReportName, _
    View:=acViewPreview, _
    WhereCondition:=strCriteria

    Else
    MsgBox MESSAGETEXT, vbExclamation, "Invalid operation"
    End If

    Exit_Here:


    Exit Sub

    Err_Handler:
    MsgBox Err.Description, vbExclamation, "Error"
    Resume Exit_Here


    End Sub

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,979
    Sounds like your form is a popup form. If that's not needed remove those property.
    Otherwise several solutions possible - use whichever suits your needs best: hide your form when opening the report or make your report a popup or open it in dialog mode
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    yes its a popup form and is needed
    what code should i add to the code by which when "PurSupRpt1" report opens the form "DialogSupPur" is closed.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,979
    Two possible approaches
    1. On the form procedure that opens the report add the line DoCmd.Close acForm, Me.Name immediately after the code to open the report
    OR
    2. On the Report_Open event, add the line DoCmd.Close acForm, "YourFormNameGoesHere"

    You may want to reopen the form afterwards by adding suitable code to the Report_Close event.

    Another method is just to hide the form rather than close it e.g. using Me.Visible =False
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 03-07-2017, 04:09 AM
  2. Replies: 1
    Last Post: 09-18-2015, 02:01 PM
  3. Replies: 13
    Last Post: 07-24-2014, 04:30 PM
  4. Replies: 9
    Last Post: 05-03-2014, 03:36 PM
  5. Replies: 1
    Last Post: 01-22-2013, 09:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums