L
LoriO
I open a form with a strWhere result and if there are no selections to filter
by, I give a no criteria message and the form is opening using the last
filter.
I want the form to open unfiltered if there is no criteria.
I am not doing well -
What is the best way to accomplish this?
When I close the form do I need to enter something?
or add something to the code below:
Private Sub OptionDocDetail_Click()
DoCmd.Minimize
Dim strWhere As String
Dim lngLen As Long
strWhere = ""
If (Me.Cbo_AssignedTo) = "" Then
strWhere = ""
ElseIf (Me.Cbo_AssignedTo) <> "" Then
strWhere = strWhere & "([ComboAssign]Like " & "'*" & Me.Cbo_AssignedTo
& "*'" & ") AND "
End If
If (Me.cbo_module) <> "" Then
strWhere = strWhere & "([ModuleName] = " & "'" & Me.cbo_module & "'"
& ") AND "
ElseIf (Me.cbo_module) = "" Then
End If
If (Me.cbo_Type) <> "" Then
strWhere = strWhere & "([Type] = " & "'" & Me.cbo_Type & "'" & ")
AND "
ElseIf (Me.cbo_Type) = "" Then
End If
'Chop off the trailing " AND ".
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria"
Else
strWhere = Left$(strWhere, lngLen)
End If
DoCmd.OpenForm "frm_MT_Doc_Detail", , , strWhere
End Sub
by, I give a no criteria message and the form is opening using the last
filter.
I want the form to open unfiltered if there is no criteria.
I am not doing well -
What is the best way to accomplish this?
When I close the form do I need to enter something?
or add something to the code below:
Private Sub OptionDocDetail_Click()
DoCmd.Minimize
Dim strWhere As String
Dim lngLen As Long
strWhere = ""
If (Me.Cbo_AssignedTo) = "" Then
strWhere = ""
ElseIf (Me.Cbo_AssignedTo) <> "" Then
strWhere = strWhere & "([ComboAssign]Like " & "'*" & Me.Cbo_AssignedTo
& "*'" & ") AND "
End If
If (Me.cbo_module) <> "" Then
strWhere = strWhere & "([ModuleName] = " & "'" & Me.cbo_module & "'"
& ") AND "
ElseIf (Me.cbo_module) = "" Then
End If
If (Me.cbo_Type) <> "" Then
strWhere = strWhere & "([Type] = " & "'" & Me.cbo_Type & "'" & ")
AND "
ElseIf (Me.cbo_Type) = "" Then
End If
'Chop off the trailing " AND ".
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria"
Else
strWhere = Left$(strWhere, lngLen)
End If
DoCmd.OpenForm "frm_MT_Doc_Detail", , , strWhere
End Sub