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

Sort procedures on an Access Form!!! 1

Status
Not open for further replies.

ADW

Programmer
Jun 21, 2001
50
GB
I want to include a sort function on a command button on an Access form. Does anyone know the code for this?
 
Option Compare Database
Option Explicit

'------------------------------------------------------------
' sortdown_stock
'
'------------------------------------------------------------
Function sortdown_stock()
On Error GoTo sortdown_stock_Err

DoCmd.GoToControl "stock-no" 'set focus on field ,control you want to sort
DoCmd.RunCommand acCmdSortAscending 'sort ascending or deascending


'or insert event procedure (onclick) on your button
'DoCmd.GoToControl "stock-no"
'DoCmd.RunCommand acCmdSortAscending
sortdown_stock_Exit:
Exit Function

sortdown_stock_Err:
MsgBox Error$
Resume sortdown_stock_Exit

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top