Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Select Sort on one of 4 or 5 fields

26 views
Skip to first unread message

BobbyDazzler

unread,
May 18, 2012, 11:20:54 AM5/18/12
to
I have a list box and a text field on a form. The user enters a tyre
(tire) size into the text field and the OnUpdate event requeries the
list box to show any products which start with the size entered into
the textbox. I currently sort them by ascending sale price as this is
all the customer is interested in :-) However, new legislation means
each tyre/tire needs to have a label containing details of it's
rolling resistance (A to G) it's Wet Grip (again A to G) and it's
Noise Emission (in decibels) I need to be able to view the list of
products and select price, rolling resistance, wet grip or noise
emission and sort them in either ascending or descending order. I
know I can't do this in a list box and wondered if anyone had solved
this particular problem and could share their method?

Patrick Finucane

unread,
May 18, 2012, 2:13:05 PM5/18/12
to
I created a form with two textboxes and a listbox. In the listbox I
created an OnClick event. As I up/down arrow or click on a listbox
item it runs the OnClick event and fills the values in the textbox
depending on the key value in the listbox.
Private Sub List0_Click()
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("ImportFileNames",
dbOpenSnapshot)
rst.FindFirst "ImportID = " & Me.List0
Me.ImpDate = rst!ImportDate 'fill in the text boxes
Me.ImpUser = rst!ImportUser
rst.Close
Set rst = Nothing
End Sub

I don't know if this answers or assists in your question.

Phil

unread,
May 18, 2012, 6:38:57 PM5/18/12
to
I do something similar with a list box to find people by Reference no, Name,
Town or Area. Briefly I gave an option group with 4 option buttons
corresponding to the 4 methods of searching. The list box as 6 visible
columns and 1 invisible column (width = 0) which is the bound column. The
AfterUpdate of the option group changes the RowSource of the Listbox so that
the thing I am searching appears on the left e.g. Wet grip in your case,
changes the widths of the columns to suit. I guess that the A to G letters
are narrow columns, price, noise and width a bit wider, and type make quite
wide. If on your SQL for each option, if you give an alias for the field
name, you will get sensible descriptions if each column in your list box.
It's a lot of codeing nut works well.

HTH

Phil
0 new messages