Address unbound listbox

  • Thread starter Thread starter Harmannus
  • Start date Start date
H

Harmannus

Hallo,

How do i address an unbound listbox (=CPList) in the below "OrderBy"
statement? Tried various combinations but can't get it to work.

Forms![frmCP].CPList.OrderBy = "qselCPList.Lastname"
Me.CPList.Requery

I get a error message if i use the above.

CP stands for Contactperson.

Thanx for any tips.


Regards,

Harmannus

---- Full code ---

Me.Requery
Select Case Sorteren.Value
Case "1"
Forms![frmCP].OrderBy = "tblCP.Lastname"
Forms![frmCP].CPList.OrderBy = "qselCPList.Lastname"
Me.CPList.Requery
Case "2"
Forms![frmCP].OrderBy = "tblCP.Firstname"
Case "3"
Forms![frmCP].OrderBy = "tblCP.OrganizationID"
End Select
 
CPList is a control on the form, not a property.
Therefore, try preceeding it with an exclamation point
rather than a period, like so:

Forms![frmCP]![CPList].OrderBy

Chuck
 
Harmannus said:
How do i address an unbound listbox (=CPList) in the below "OrderBy"
statement? Tried various combinations but can't get it to work.

Forms![frmCP].CPList.OrderBy = "qselCPList.Lastname"
Me.CPList.Requery

I get a error message if i use the above.


List boxes do not have an OrderBy property. You should set
the box's RowSource to a query that sorts the records.
 
Back
Top