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