How to order data on another form?

  • Thread starter Thread starter Lee
  • Start date Start date
L

Lee

Hi there,
On clicking a button on Form A, I would like the records
in Form B to be ordered (sorted) in a particular way. I
can't seem to get this to work and I now wonder if it's
possible. On the click event for Form A I've got the
following:

DoCmd.SelectObject acForm, "Form B", False
Form.OrderByOn = True
Form.OrderBy = "CentreNo"

I've tried all sorts of versions of this but nothing
seems to work, any ideas?
Hope you can help.
With thanks,
Lee
 
Change the recordsource of form B with a bit of code in a command button
like this:

Forms!FormB.Recordsource = "Select * From tblSomeTable Order By CentreNo;"

Form B will requery to that sort order. Obviously you'll want to first make
sure the form is open, and you may also have a more complex select
statement, but that is the gist of it.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top