Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Filter Form

Status
Not open for further replies.

Elvis72

Technical User
Dec 6, 2007
211
US
I have this code for one of my text boxes:

If Not IsNull(Me.txtfirstname) Then
strWhere = strWhere & "([First Name] Like ""*" & Me.txtfirstname & "*"") AND "
End IF

Now, I need to make one that can handle a range of numbers.

I have the following field:

Years Experience

They need to be able to type in

Years Experience
Minimum: 5
Maximum: 25

And it bring up all records that have between 5-25 years of experience.

Any help?

 
How are ya Elvis72 . . .

Have a look at the [blue]InputBox[/blue] function!

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
I'd use two TextBox.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV -

I did put two text boxes, but how to get it to recognize both of them as a range that is linked I'm lost...

 
What is your actual code with the 2 textbox and where are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
It is:

If Not IsNull(Me.txtyrsexp) Then
strWhere = strWhere & "([Years Experience] = """ & Me.txtyrsexp & """) AND "
End If

If Not IsNull(Me.txtyrsexpend) Then 'Less than the next day.
strWhere = strWhere & "([Years Experience] = """ & Me.txtyrsexpend & """) AND "
End If
 
What about this ?
Code:
If Not IsNull(Me.txtyrsexp) Then
  strWhere = strWhere & "([Years Experience]>='" & Me.txtyrsexp & "') AND "
End If
If Not IsNull(Me.txtyrsexpend) Then   'Less than the next day.
  strWhere = strWhere & "([Years Experience]<='" & Me.txtyrsexpend & "') AND "
End If

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV -

It works great when I type in 20-30 but for some reason when I type in 1-5 I get other numbers besides those?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top