First let me say this is my first post at this form so please bear with me. I have always found the answers I needed here without posting so I want to do a big shout out to this community and how knowledgeable all of you are. Thank you for the years of support!
Now to my question =)
I’m building a continues Form that has 2 text boxes that are dates that I use to lookup data on the from between the 2 dates. After inputting the 2 dates I can update the form after I click a requery button I made which works with no problems.
Requery Button Code:
I then put code in to filter my drop down fields on my form which works with no problem (see below).
Filter Code:
The error I am finding is that after I use the filter code I’m able to requery the form, but if I clear all the fields or run my refresh button it will not requery the form. Any help is most appreciative.
:banghead:
Now to my question =)
I’m building a continues Form that has 2 text boxes that are dates that I use to lookup data on the from between the 2 dates. After inputting the 2 dates I can update the form after I click a requery button I made which works with no problems.
Requery Button Code:
Code:
Private Sub cmdReset_Click()
Me.cmbType.Value = "Type"
Me.cmbFndBy.Value = "Found By"
Me.cmbFndBy.BackColor = 11920639
Me.cmbFoundIn.Value = "Found In"
Me.cmbAprSup.Value = "Approving Sup"
Me.cmbAprSup.BackColor = 11920639
Me.frmAllorEmpt = 1
Me.Filter = ""
Me.FilterOn = False
Me.Requery
End Sub
I then put code in to filter my drop down fields on my form which works with no problem (see below).
Filter Code:
Code:
Private Sub FilterStatusForm()
Dim strWhere As String
'Make string
If Me.cmbType <> "Type" Then
strWhere = strWhere & "[Type] = '" & Me.cmbType & "' AND "
End If
If Me.frmAllorEmpt = 2 Then
strWhere = strWhere & "Nz([TimeStamp], 0) = 0 AND "
End If
If Me.cmbFoundIn <> "Found In" Then
strWhere = strWhere & "[ProbFoundIn]='" & Me.cmbFoundIn & "' AND "
End If
If Not IsNull(Me.cmbAprSup.Value) And Not Me.cmbAprSup.Value = "Approving Sup" Then
strWhere = strWhere & "[ApprovingSup]='" & Me.cmbAprSup & "' AND "
End If
If Not IsNull(Me.cmbFndBy.Value) And Not Me.cmbFndBy.Value = "Found By" Then
strWhere = strWhere & "[FndBy]='" & Me.cmbFndBy & "' AND "
End If
'Apply filter
If strWhere <> "" Then
strWhere = Left(strWhere, Len(strWhere) - 5) 'Remove the extra AND
Me.Filter = strWhere
Me.FilterOn = True
Else
Me.cmbType.Value = "Type"
Me.cmbFndBy.Value = "Found By"
Me.cmbFoundIn.Value = "Found In"
Me.cmbAprSup.Value = "Approving Sup"
Me.frmAllorEmpt = 1
Me.Filter = ""
Me.FilterOn = False
End If
End Sub
The error I am finding is that after I use the filter code I’m able to requery the form, but if I clear all the fields or run my refresh button it will not requery the form. Any help is most appreciative.
:banghead: