Sorting based on selected value...Please help!

  • Thread starter Thread starter MadCSS
  • Start date Start date
M

MadCSS

I am trying to create a simple form where the users would enter (or select)
the VIN number and all of the repairs that match that VIN number (and ONLY
that VIN number) will be displayed. I cannot save a filter for this because
users will obviously want to search for many different VIN numbers. Am
completely unfamiliar with coding, but there must be a simple way to do this
without! Would appreciate any suggestions!
 
Hi

I assume you have a field in the table called VIN

Create a continous form based on the table. Call it Form1

Create a new form (Form2). Put a button (called ButtonName) on this and a
text box (called Vin_Number_Input)

Put this OnClick of the button

Private Sub ButtonName_Click()
DoCmd.OpenForm "Form1", acNormal, "", _
"[VIN]=[Forms]![Form2]![VIN_Number_Input]", , acNormal
End Sub


Type in a VIN number into the text box and click the button
 
MadCSS said:
I am trying to create a simple form where the users would enter (or select)
the VIN number and all of the repairs that match that VIN number (and ONLY
that VIN number) will be displayed. I cannot save a filter for this because
users will obviously want to search for many different VIN numbers. Am
completely unfamiliar with coding, but there must be a simple way to do this
without! Would appreciate any suggestions!

Try a parameter query. Google has lots of video demos of this if you
search for "access parameter queries". Essentially you put:
=[VIN]
... in the criterion line of your query under the VIN field, and when the
query is run, Access will pop up an invitation to enter the VIN you
want. Base your form on that query (using a wizard) and you're just
about done. Dead easy!

HTH

Phil
 
Hi Phil

Not too sure about that - OK it will work but will mean it's a little
difficult to use for other "stuff". If you're going down that road you may
be better adding a Null criteria (or better a QBF)

eg

SELECT TableName.VIN
FROM TableName
WHERE (((TableName.VIN)=[Forms]![SomeFormName]![VIN])) OR
((([Forms]![SomeFormName]![VIN]) Is Null));


just a thought :-)


--
Wayne
Manchester, England.



Philip Herlihy said:
MadCSS said:
I am trying to create a simple form where the users would enter (or select)
the VIN number and all of the repairs that match that VIN number (and ONLY
that VIN number) will be displayed. I cannot save a filter for this because
users will obviously want to search for many different VIN numbers. Am
completely unfamiliar with coding, but there must be a simple way to do this
without! Would appreciate any suggestions!

Try a parameter query. Google has lots of video demos of this if you
search for "access parameter queries". Essentially you put:
=[VIN]
... in the criterion line of your query under the VIN field, and when the
query is run, Access will pop up an invitation to enter the VIN you
want. Base your form on that query (using a wizard) and you're just
about done. Dead easy!

HTH

Phil
 
Wayne-I-M said:
Hi Phil

Not too sure about that - OK it will work but will mean it's a little
difficult to use for other "stuff". If you're going down that road you may
be better adding a Null criteria (or better a QBF)

eg

SELECT TableName.VIN
FROM TableName
WHERE (((TableName.VIN)=[Forms]![SomeFormName]![VIN])) OR
((([Forms]![SomeFormName]![VIN]) Is Null));


just a thought :-)

Yes, that's how I'd do it, but if you look at it from the OP's
perspective a PQ will get him working in seconds, but I think you'd have
a bit of hand-holding to do if you were going to take him through the
alternative!

Phil
 
Back
Top