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

Problem with V B coding in Access

Status
Not open for further replies.

tyleri

Programmer
Jan 2, 2001
173
US
I am getting an error - all I am trying to do is sort the form by a textbox field - and this code is not working - anyone have any ideas?


Private Sub Form_On_Load()

Me.OrderBy = Me![mf_id]
Me.OrderByOn = True

End Sub
 
NEvermind - I figured out how to do it - much simpler manner - I found in the properties of the Access form an area called "order by" and i typed in "MF_ID".

 
Glad you fixed it. If you need to do it in code some day, it would be:
Me.OrderBy = "MF_ID"
Me.OrderByOn = True

The OrderBy property value is a string containing a partial SQL statement (the part in the ORDER BY clause). You wanted the name of the field, but Me![mf_id] assigned the field's value instead. That's why it didn't work. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top