Two-way Sub-form

  • Thread starter Thread starter Nancy
  • Start date Start date
N

Nancy

I'm trying to add a sub-form to a switchboard form that
displays a list of names in alphabetical order by first
name or by last name, depending on which command button
is chosen. I have the queries built for first or last
name order. How can I make alternating queries appear in
the same space depending on which button is clicked?
 
Nancy said:
I'm trying to add a sub-form to a switchboard form that
displays a list of names in alphabetical order by first
name or by last name, depending on which command button
is chosen. I have the queries built for first or last
name order. How can I make alternating queries appear in
the same space depending on which button is clicked?
I assume you are using a subform.
Setting the recordset to the appropriate query is one way.
Using a tabbed form with a different subform would be another.
Making one form visible and another invisible is a third.

It depends on what the client wants but I always make an effort to have them
learn to right click and sort on the column they want rather than use
buttons. This works everywhere and gives them more freedom.
 
I'm trying to add a sub-form to a switchboard form that
displays a list of names in alphabetical order by first
name or by last name, depending on which command button
is chosen. I have the queries built for first or last
name order. How can I make alternating queries appear in
the same space depending on which button is clicked?

One way is to change the subform's OrderBy property in the button's
click event: something like

Private Sub cmdSortLast_Click()
Me!subformname.Form.OrderBy = "[LastName]"
Me!subformname.Form.OrderByOn = True
End Sub

Or use the same event to change the subform's Recordsource property if
the queries have more than just the one change.
 
Back
Top