G
Guest
Problem:
I receive the 'OpenForm Action was canceled' pop-up. Code works for CmdRegions...But for CmbAccess/[Electronic Evaluations?] it does not. As [Electronic Evaluations?] is a Yes/No field, could this be the problem...and what code would work for Yes/No checkboxes?
Code:
Private Sub CmdOK_Click()
On Error GoTo Err_CmdOK_Click
Dim strWhere As String
Dim strLink As String
Const strcJetDate = "\#mm\/dd\/yyyy\#"
If Len(Me.CmbFilter & vbNullString) = 0 Then
MsgBox "Please select one of the options.", vbInformation, "Selection Required"
ElseIf Me.CmbFilter = "See All" Then
DoCmd.OpenForm "Clients Test"
DoCmd.Close acForm, "Clients w Filters"
ElseIf Me.CmbFilter = "Filter By.." Then
If Not IsNull(Me.CmbRegions) And CmbRegions.Value <> "All" Then
strWhere = strWhere & strLink & "[Regions]=""" & CmbRegions & """"
strLink = " And "
If Me.CmbRegions.Value = All Then
strWhere = strWhere & strLink
strLink = " And "
End If
End If
If Not IsNull(Me.CmbAccess) And CmbAccess.Value <> "All" Then
strWhere = strWhere & strLink & "[Electronic Evaluations?]=""" & CmbAccess & """"
strLink = " And "
If Me.CmbAccess.Value = "All" Then
strWhere = strWhere & strLink
strLink = " And "
End If
End If
DoCmd.OpenForm "Clients Test", acNormal, , strWhere
DoCmd.Close acForm, "Clients w Filters"
I receive the 'OpenForm Action was canceled' pop-up. Code works for CmdRegions...But for CmbAccess/[Electronic Evaluations?] it does not. As [Electronic Evaluations?] is a Yes/No field, could this be the problem...and what code would work for Yes/No checkboxes?
Code:
Private Sub CmdOK_Click()
On Error GoTo Err_CmdOK_Click
Dim strWhere As String
Dim strLink As String
Const strcJetDate = "\#mm\/dd\/yyyy\#"
If Len(Me.CmbFilter & vbNullString) = 0 Then
MsgBox "Please select one of the options.", vbInformation, "Selection Required"
ElseIf Me.CmbFilter = "See All" Then
DoCmd.OpenForm "Clients Test"
DoCmd.Close acForm, "Clients w Filters"
ElseIf Me.CmbFilter = "Filter By.." Then
If Not IsNull(Me.CmbRegions) And CmbRegions.Value <> "All" Then
strWhere = strWhere & strLink & "[Regions]=""" & CmbRegions & """"
strLink = " And "
If Me.CmbRegions.Value = All Then
strWhere = strWhere & strLink
strLink = " And "
End If
End If
If Not IsNull(Me.CmbAccess) And CmbAccess.Value <> "All" Then
strWhere = strWhere & strLink & "[Electronic Evaluations?]=""" & CmbAccess & """"
strLink = " And "
If Me.CmbAccess.Value = "All" Then
strWhere = strWhere & strLink
strLink = " And "
End If
End If
DoCmd.OpenForm "Clients Test", acNormal, , strWhere
DoCmd.Close acForm, "Clients w Filters"