A family of Microsoft relational database management systems designed for ease of use.
Would this be correct? I'm still not getting it to work, and would think OR would work???
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 & ") OR"
End If
If Not IsNull(Me.cboSpecialty) Then
strWhere = strWhere & "([sSpecialtyID] = " & Me.cboSpecialty & ") OR "
End If
If Not IsNull(Me.cboSubSpecialty) Then
strWhere = strWhere & "([ssSubSpecialtyID] = " & Me.cboSubSpecialty & ") OR"
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