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!

Sort Button Parameter Error 1

Status
Not open for further replies.

cstuart79

Technical User
Nov 2, 2009
171
US
I am trying to use a button "command248" on main form "CLIENTS" to sort by field "Group_Type" on subform "CONTACTS".
In order to accomplish this I added the following code to the "On Click" event of button "command248":

Public Sub OrderForm(strOrder As String, frm As Access.Form)
frm.OrderByOn = False
frm.OrderBy = strOrder
frm.OrderByOn = True
End Sub

Private Sub Command248_Click()
Call OrderForm("Group_Type", Me)
Call OrderForm("Group_Type", Me.CONTACTS.Form)
End Sub

It works properly, but I keep getting this pop-up:

Enter Parameter Value
Group_Type

All of the spelling is accurate--it seems as though the error has to do with entry in "Order By" for Property Sheet.
When I change this from "Group_Type" to something like "strOrder", then the error says "strOrder" parameter value instead of "Group_Type" parameter value.
Not sure if this is the problem or if I need to change something else????

Also, do I need to enter code in any other event box to keep the data sorted (by group type for example) until a different sort button (by last name for example) is clicked?

 
can you post to a file sharing site? I will take a look. If necessary remove any proprietary data and provide just a demo set. I use 4shared.com, but you can choose any.
 
my subform "CONTACTS" has record source of "CONTACTS" which includes field [Group_Type].
however, my main form "CLIENTS" has record source of "CLIENTS" which does not include [Group_Type]. the only common field between main form "CLIENTS" and subform "CONTACTS" is field "Client_ID". however, the sort button is located on main form "CLIENTS" while controlling sorting on subform "CONTACTS".
 
Then you can't attempt to filter "Me" on the field that doesn't exist in Me.
Code:
Private Sub Command248_Click()
 [s]Call OrderForm("Group_Type", Me)[/s]
 Call OrderForm("Group_Type", Me.CONTACTS.Form)
End Sub

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top