Filter form with two text boxes/Command Button

elizabethcke

New member
Local time
Today, 04:12
Joined
Dec 12, 2012
Messages
7
Hello!

I desperately need some help. I am trying to filter a form by using two unbound text boxes that a user can enter in their criteria and then clicking a command button to filter the form using the criteria entered into the text boxes. My fields are as follows:

Bound Field: MondayD1
Unbound text box: txtMonday
Bound Field: SundayD7
Unbound text box: txtSunday
Command Button: cmdSelect

MondayD1 = txtMonday
SundayD7 = txtSunday

I have looked up several options using vb for the on click event of the command button but I either get an error message or the form shows up blank.

Any help would be greatly appreciated!!! :banghead:
 
In the click event of the button

Code:
Private Sub cmdSelect_Click()
Dim strFilter As String
 
   strFilter = "[MondayD1]>=#" & Me.txtMonday & "# And [SundayD7]<=#" & Me.txtSunday & "#"
 
   Me.Filter = strFilter
   Me.FilterOn = True
End Sub
 
Thank you so much!!! I was close but forgot about the >=# and <=#. You're brilliant. :)
 

Users who are viewing this thread

Back
Top Bottom