I ended up bringing in two subforms as the search still is not working. I was also afraid people may be confused with everything the way it used to be - with only one search button. The two sub-forms are called sfrSearchSpecialty and sfrSearchSubSpecialty
to the right of the screen. So now I have:

If I do search on the subform Speciality for "Orthopedic Surgery" it comes up, and gives us all the Ortho Surgeons so that's great:

If I do a search on the subform Specialty for Internal Medicine, it gives me three IM providers in two different offices, so I am happy with that, as it is working somewhat. It's not picking up all IM providers in all offices though. The first office actually
has five providers, and the second office has two providers.

If I do search on the subform SubSpeciality for "Knee" it comes up, and gives us all the Ortho Surgeons that work on knees, so that's great. Unfortunately it doesn't work on the other subspecialities and I'm not sure why.

Unfortunately the main search, with Provider + Visit + Insurance is returning a ton of duplicates, repeating the one item over and over.

I will be working on this all weekend, trying to fix the main search so it does not repeat 50 times, and also trying to fix the other searches. Thank you so much for your time and help.
Main Search:
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
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
Specialty Search:
Option Compare Database
Option Explicit
Private Sub BtnResetSpecialty_Click()
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 BtnSearchSpecialty_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.cboSpecialty) Then
strWhere = strWhere & "([sSpecialtyID] = " & Me.cboSpecialty & ") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
strSQL = strSQL
DoCmd.OpenReport "rptResultsSpecialty", acViewReport
DoCmd.Maximize
Else
strWhere = Left$(strWhere, lngLen)
strSQL = strSQL & " WHERE " & strWhere
DoCmd.OpenReport "rptResultsSpecialty", acViewReport, , strWhere
DoCmd.Maximize
Reports![rptResultsSpecialty].Filter = strWhere
Reports![rptResultsSpecialty].FilterOn = True
End If
End Sub
Private Sub cboSpecialty_Click()
Me.cboSpecialty.Requery
End Sub
Sub-Specialty Search:
Option Compare Database
Option Explicit
Private Sub BtnResetSubSpec_Click()
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 BtnSearchSubSpec_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.cboSubSpecialty) Then
strWhere = strWhere & "([ssSubSpecialtyID] = " & Me.cboSubSpecialty & ") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
strSQL = strSQL
DoCmd.OpenReport "rptResultsSubSpecialty", acViewReport
DoCmd.Maximize
Else
strWhere = Left$(strWhere, lngLen)
strSQL = strSQL & " WHERE " & strWhere
DoCmd.OpenReport "rptResultsSubSpecialty", acViewReport, , strWhere
DoCmd.Maximize
Reports![rptResultsSubSpecialty].Filter = strWhere
Reports![rptResultsSubSpecialty].FilterOn = True
End If
End Sub
Private Sub cboSubSpecialty_Click()
Me.cboSubSpecialty.Requery
End Sub