Hi Gina,
Thank you for your suggestions. I opened the report right from the Navigation Pane and the pop ups still occurred. I have tried everything to remove the two pop ups. I guess I have to delete that report and do a new one from scratch as I have spent over
eight hours trying to fix the pop ups.
I'm also noticing that my search isn't resetting. So when the user returns to the search from the form, the search won't work. The user has to close everything then open it again for the search to work.
The first four are Combo List Boxes, and the last item is a text box. So I've updated the code - thank you so much.
Now my code is:
Option Compare Database
Option Explicit
Private Sub BtnReset_Click()
Me.cboProviderName = ""
Me.cboVisitType = ""
Me.cboSpecialty = ""
Me.cboInsurance = ""
Me.txtSubSpecialty = ""
End Sub
Private Sub BtnSearch_Click()
On Error Resume Next
Dim strWhere As String
Dim strSQL As String
Dim lngLen As Long
'Number field example. Do not add the extra quotes.
If Not IsNull(Me.cboProviderName) Then
strWhere = strWhere & "([pProviderID] = " & Me.cboProviderName & ") AND "
End If
If Not IsNull(Me.cboVisitType) Then
strWhere = strWhere & "([vVisitID] = " & Me.cboVisitType & ") AND "
End If
If Not IsNull(Me.cboInsurance) Then
strWhere = strWhere & "([piInsuranceID] = " & Me.cboInsurance & ") AND "
End If
If Not IsNull(Me.cboSpecialty) Then
strWhere = strWhere & "([sSpecialtyID] = " & Me.cboSpecialty & ") AND "
End If
If Not IsNull(Me.txtSubSpecialty) Then
strWhere = strWhere & "([pSubSpecialty] = """ & Me.txtSubSpecialty & """) AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
strSQL = strSQL
DoCmd.OpenReport "rptResults", acViewReport
DoCmd.Maximize
Else
strWhere = Left$(strWhere, lngLen)
strSQL = strSQL & " WHERE " & strWhere
DoCmd.OpenReport "rptResults", acViewReport, , strWhere
DoCmd.Maximize
Reports![rptResults].Filter = strWhere
Reports![rptResults].FilterOn = True
End If
End Sub
Private Sub cboInsurance_Click()
Me.cboInsurance.Requery
End Sub
Private Sub cboProviderName_AfterUpdate()
' set Visit Type and Insurance combo boxes to Null
' and requery controls to show Visit Type in selected Provider
Me.cboVisitType = Null
Me.cboVisitType.Requery
Me.cboInsurance = Null
Me.cboInsurance.Requery
' requery form to show Provider choice
Me.Requery
End Sub
Private Sub cboVisitType_AfterUpdate()
' set Insurance combo box to Null
' and requery control to show Insurance in Visit Type
Me.cboInsurance = Null
Me.cboInsurance.Requery
' requery form to show Visit in selected Visit Type
Me.Requery
End Sub
Private Sub cboInsurance_AfterUpdate()
' requery form to show Insurance name in selected Insurance
Me.Requery
End Sub
Private Sub cboVisitType_Click()
Me.cboVisitType.Requery
End Sub
And my row sources are:
SELECT tblProvider.pProviderID, [pLast] & " " & [pFirst] AS Provider FROM tblProvider ORDER BY tblProvider.pLast;
SELECT tblVisit.vVisitID, tblVisit.vType FROM tblOfficeProvider INNER JOIN tblVisit ON tblOfficeProvider.opOfficeProviderID = tblVisit.vOfficeProviderID WHERE (((tblOfficeProvider.opProviderID)=[Forms]![frmSearch]![cboProviderName])) ORDER BY tblVisit.vType;
SELECT tlkpInsurances.iInsuranceID, tlkpInsurances.iName FROM tlkpInsurances INNER JOIN tblProviderInsurance ON tlkpInsurances.iInsuranceID = tblProviderInsurance.piInsuranceID WHERE (((tblProviderInsurance.piProviderID)=[Forms]![frmSearch]![cboProviderName]))
ORDER BY tlkpInsurances.iName;
SELECT tlkpSpecialty.sSpecialtyID, tlkpSpecialty.sSpecialty FROM tlkpSpecialty ORDER BY sSpecialty;