Home All Groups Group Topic Archive Search About

Sorting based on selected value...Please help!

Author
8 Jul 2009 7:05 AM
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!

Author
8 Jul 2009 10:34 AM
Wayne-I-M
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


--
Wayne
Manchester, England.



Show quoteHide quote
"MadCSS" wrote:

> 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!
Are all your drivers up to date? click for free checkup

Author
8 Jul 2009 10:46 AM
Philip Herlihy
MadCSS wrote:
> 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
Author
8 Jul 2009 10:57 AM
Wayne-I-M
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.



Show quoteHide quote
"Philip Herlihy" wrote:

> MadCSS wrote:
> > 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
>
Author
8 Jul 2009 11:05 AM
Philip Herlihy
Wayne-I-M wrote:
Show quoteHide quote
> 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

Bookmark and Share