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

Form sort order

Status
Not open for further replies.

simon373

Programmer
Oct 25, 2006
25
Hi,

I have a form which displays a list of equipment by manufacurer. I would like the order of the equipment to be sorted alphabetically by manufacturer when the form is opened. However, The manufacturer name is retrieved via a query using the manufacturer ID. Therefore, on the form, I am only able to sort by manufacturer ID (as shown below). Could anyone please advise how I would sort by manufacturer name bearing in mind that it is retrieved through a query.


Private Sub Form_Open(Cancel As Integer)
Me.OrderBy = "ManufacturerID"
Me.OrderByOn = True
End Sub

Many thanks.

Simon.
 
Why not joining the Manufacturer table in the form's RecordSource ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
You need to edit the query to include the table with manufacturer's names. For example:

[tt]SELECT tblEquipment.ManufacturerID,
tblManufacturer.ManufacturerName
FROM tblEquipment
INNER JOIN tblManufacturer
ON tblEquipment.ManufacturerID
=tblManufacturer.ManufacturerID
ORDER BY tblManufacturer.ManufacturerName[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top