By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,549 Members | 1,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,549 IT Pros & Developers. It's quick & easy.

"Order By" fails in form for linked table.

P: n/a
"Order By" fails in form for linked table.
--------------
My A2K database has worked well for several years, but now has been split
into front-end/back-end and has the following problem. I have a form to access
a table which I'll call "NameTable". It has a simple structure:
------------
EmployeeID FirstName (Other fields)
(autonumber,
primary key)
---------------
1 Baker
2 Dog
3 Charlie
4 Edward
5 Able

---------------
In the form, the "Record Source" is "NameTable", and the "Order By" is
"NameTable.FirstName"
---------------
When the NameTable was in the same module as the main program, this worked
fine. When the form came up, the first record displayed had the name "Able,"
and if you went to the Next Record (click on the arrow at the base of the
screen) you then went to Baker, Charlie, etc.
But now, the NameTable is in another Access module, and is accessed via a link.
When the form comes up, the first record shown is Baker, then Dog, etc, that
is, in the order of the EmployeeID, the primary key. It doesn't matter what
field I put in the "Order By" variable; the order always is the primary key.
All the rest of the controls work OK, and I can enter and/or change any field I
want.
Am I missing something? Thanks. Pete Brady
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Did you remember to set the OrderByOn property as well?

A better solution might be to change the RecordSource property of the form
to a query statement that specifies how you want it sorted:
SELECT TableName.* FROM TableName ORDER BY FirstName;

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Ptbrady" <pt*****@aol.com> wrote in message
news:20***************************@mb-m12.aol.com...
"Order By" fails in form for linked table.
--------------
My A2K database has worked well for several years, but now has been split into front-end/back-end and has the following problem. I have a form to access a table which I'll call "NameTable". It has a simple structure:
------------
EmployeeID FirstName (Other fields)
(autonumber,
primary key)
---------------
1 Baker
2 Dog
3 Charlie
4 Edward
5 Able

---------------
In the form, the "Record Source" is "NameTable", and the "Order By" is
"NameTable.FirstName"
---------------
When the NameTable was in the same module as the main program, this worked
fine. When the form came up, the first record displayed had the name "Able," and if you went to the Next Record (click on the arrow at the base of the
screen) you then went to Baker, Charlie, etc.
But now, the NameTable is in another Access module, and is accessed via a link. When the form comes up, the first record shown is Baker, then Dog, etc, that is, in the order of the EmployeeID, the primary key. It doesn't matter what field I put in the "Order By" variable; the order always is the primary key. All the rest of the controls work OK, and I can enter and/or change any field I want.
Am I missing something? Thanks. Pete Brady

Nov 12 '05 #2

P: n/a
Allenb, Thanks for your reply. I put this command in the "On Current" event
for the table:
OrderByOn = True
This fixes the problem. However, I still cannot understand why this would not
be automatic when I have an "Order by" specified, and why it works in a table
within this mdb module and but not when it is linked.
Anyway, thank you for getting me out of this bind! Pete Brady
Nov 12 '05 #3

P: n/a
(Putting it in the Open event may be more efficient.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Ptbrady" <pt*****@aol.com> wrote in message
news:20***************************@mb-m24.aol.com...
Allenb, Thanks for your reply. I put this command in the "On Current" event for the table:
OrderByOn = True
This fixes the problem. However, I still cannot understand why this would not be automatic when I have an "Order by" specified, and why it works in a table within this mdb module and but not when it is linked.
Anyway, thank you for getting me out of this bind! Pete Brady

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.