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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter by using inputbox

Status
Not open for further replies.

maes2

Technical User
Jan 22, 2002
7
SE
Can anyone help me how to do this:

I want the user to just click a button, a inputbox pops up asking for: "Enter the first SerialNo"-----ENTER
A new Inputbox pops up asking: "Enter the last SerialNo"-----ENTER.
Then it filter (Between First and Last value).

I had an Idea:
*****************************************************
Private Sub Commandbutton4_Click()
Dim First
Dim Last
First = InputBox("Enter the first SerialNo")
Last = InputBox("Enter the last SerialNo")

Me.Filter = Between "First" and "Last"

Me.FilterOn = True

End Sub

******************************************************
This code does not work, but how can I make it ??
Please help it´s urgent.
//Magnus
 
I think you are close. Try this...
Me.Filter = "Var Between '" & First & "' And '" & Last
Me.FilterOn = True

Var would be the name of the field you are sorting on. And don't forget to turn the filter on!

HTH
Ken ::)
 
It worked allright, thanks !
I publish the total code in case someone needs it:

//Magnus

CODE:
******

'Turn On filter'

Private Sub Commandbutton10_Click()
Dim First
Dim Last
First = InputBox("Enter the first SerialNo")
Last = InputBox("Enter the last SerialNo")

Me.Filter = "serienr Between " & First & " And " & Last

Me.FilterOn = True

End Sub


'Turn off filter'

Private Sub Commandbutton11_Click()
Me.FilterOn = False

End Sub
 
You are very welcome. I'm glad I could help!

Ken ::)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top