I broke the database again: :( I changed the SubSpecialty text box to a table as I couldn't get the text to work, and created two more tables. The search needs to search by "Provider Name, Visit Type, Insurance" OR Specialty (no other Combo Boxes); OR
Sub-Specialty (no other Combo Boxes).
So my relationships now are:

Then I updated the macro:
Option Compare Database
Option Explicit
Private Sub BtnReset_Click()
Me.cboProviderName = ""
Me.cboVisitType = ""
Me.cboInsurance = ""
Me.cboSpecialty = ""
Me.cboSubSpecialty = ""
Dim ctl As Control
For Each ctl In Me.Section("Detail").Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next
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.cboSubSpecialty) Then
strWhere = strWhere & "([ssSubSpecialtyID] = " & Me.cboSubSpecialty & ") 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 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
Private Sub cboInsurance_Click()
Me.cboInsurance.Requery
End Sub
My Record Source in Report is:
SELECT tblOffice.oName, tblOffice.oUrgent, tblOffice.oNotes, tblOffice.oRefill, tblOffice.oBack, tblOffice.oFront, tblOffice.oEmail, tblOffice.oAddress, tblOffice.oCity, tblOffice.oState, tblOffice.oZip,
[tblProvider].[pFirst] & " " & [pLast] AS Expr1, tblProvider.pSpecialty, tlkpSubSpecialty.ssName, tblProvider.pNotes, tblVisit.vType, tblVisit.vArrival, tblVisit.vNotes, tblVisit.vLength, tlkpInsurances.iName, tlkpSpecialty.sSpecialty, tblProvider.pProviderID,
tblVisit.vVisitID, tblProviderInsurance.piInsuranceID, tlkpInsStatus.isStatus, tblProviderSubSpecialty.pssSubspecialtyID, tlkpSubSpecialty.ssName FROM tlkpSubSpecialty INNER JOIN ((tlkpInsStatus INNER JOIN (tlkpSpecialty INNER JOIN ((tblProvider INNER JOIN
((tblOffice INNER JOIN tblOfficeProvider ON tblOffice.[oOfficeID] = tblOfficeProvider.[opOfficeID]) INNER JOIN tblVisit ON tblOfficeProvider.[opOfficeProviderID] = tblVisit.[vOfficeProviderID]) ON tblProvider.[pProviderID] = tblOfficeProvider.[opProviderID])
INNER JOIN (tlkpInsurances INNER JOIN tblProviderInsurance ON tlkpInsurances.[iInsuranceID] = tblProviderInsurance.[piInsuranceID]) ON tblProvider.[pProviderID] = tblProviderInsurance.[piProviderID]) ON tlkpSpecialty.sSpecialtyID = tblProvider.pSpecialty)
ON tlkpInsStatus.isStatusID = tblProviderInsurance.piInsStatusID) INNER JOIN tblProviderSubSpecialty ON tblProvider.pProviderID = tblProviderSubSpecialty.pssProviderID) ON tlkpSubSpecialty.ssSubSpecialtyID = tblProviderSubSpecialty.pssSubspecialtyID;
So it would be nice to just search Specialty alone:

Or by Sub Specialty alone:

Thank you so much for your time and help.