this code is supposed to find records with one or more criteria entered. the txt fields are for the criteria, the names only are fields from the table that are supposed to return the records.
everything that i look for works, but not the date fields. actually, the startdate field works, and then sometimes it doesnt.
what am i doing wrong?
Private Sub cmdFind2_Click()
DoCmd.ApplyFilter "", _
"([RepID] = [Forms]![frmFind2]![txtRepID] " & _
"Or IsNull([Forms]![frmFind2]![txtRepID])) " & _
"And ([StudentName] Like [Forms]![frmFind2]![txtStName] " & _
"Or IsNull([Forms]![frmFind2]![txtStName])) " & _
"And ([StudentID] Like [Forms]![frmFind2]![txtStudentID] " & _
"Or IsNull([Forms]![frmFind2]![txtStudentID])) " & _
"And ([ProgramID] Like [Forms]![frmFind2]![txtProgID]" & _
"Or IsNull([Forms]![frmFind2]![txtProgID])) " & _
"And ([RepName] Like [Forms]![frmFind2]![txtRepName]" & _
"Or IsNull([Forms]![frmFind2]![txtRepName])) " & _
"And ([AmountPaid] Like [Forms]![frmFind2]![txtAmtPaid] " & _
"Or IsNull([Forms]![frmFind2]![txtAmtPaid]))" & _
"And ([EnrolDate] like[Forms]![frmFind2]![txtEnrolD]" & _
"Or IsNull([Forms]![frmFind2]![txtEnrolD])) " & _
"And ([StartDate] like[Forms]![frmFind2]![txtStartDate]" & _
"Or IsNull([Forms]![frmFind2][txtStartDate])) ", "
this code came from Apress pro access 2010 development, page 156
This code calls the ApplyFilter method passing in the selection criteria. For each field that is in the
Form Header, the logic checks to see if the database field matches what was specified or if a value was
not specified. For the fields except CustomerID the comparison uses the Like operator. This allows for a
partial value to be supplied, such as “Ad*”
thanks for your help
everything that i look for works, but not the date fields. actually, the startdate field works, and then sometimes it doesnt.
what am i doing wrong?
Private Sub cmdFind2_Click()
DoCmd.ApplyFilter "", _
"([RepID] = [Forms]![frmFind2]![txtRepID] " & _
"Or IsNull([Forms]![frmFind2]![txtRepID])) " & _
"And ([StudentName] Like [Forms]![frmFind2]![txtStName] " & _
"Or IsNull([Forms]![frmFind2]![txtStName])) " & _
"And ([StudentID] Like [Forms]![frmFind2]![txtStudentID] " & _
"Or IsNull([Forms]![frmFind2]![txtStudentID])) " & _
"And ([ProgramID] Like [Forms]![frmFind2]![txtProgID]" & _
"Or IsNull([Forms]![frmFind2]![txtProgID])) " & _
"And ([RepName] Like [Forms]![frmFind2]![txtRepName]" & _
"Or IsNull([Forms]![frmFind2]![txtRepName])) " & _
"And ([AmountPaid] Like [Forms]![frmFind2]![txtAmtPaid] " & _
"Or IsNull([Forms]![frmFind2]![txtAmtPaid]))" & _
"And ([EnrolDate] like[Forms]![frmFind2]![txtEnrolD]" & _
"Or IsNull([Forms]![frmFind2]![txtEnrolD])) " & _
"And ([StartDate] like[Forms]![frmFind2]![txtStartDate]" & _
"Or IsNull([Forms]![frmFind2][txtStartDate])) ", "
this code came from Apress pro access 2010 development, page 156
This code calls the ApplyFilter method passing in the selection criteria. For each field that is in the
Form Header, the logic checks to see if the database field matches what was specified or if a value was
not specified. For the fields except CustomerID the comparison uses the Like operator. This allows for a
partial value to be supplied, such as “Ad*”
thanks for your help