"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 3 2205
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
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
(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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ian justice |
last post by:
Before i post actual code, as i need a speedyish reply.
Can i first ask if anyone knows off the top of their head, if there is
a likely obvious cause to the following problem.
For the moment i've...
|
by: James Johnson |
last post by:
I have 2 tables and am displaying data in a single table on a web page
from both tables. Most of the data that I'm displaying is in table 2 but
some is in table 1 (lastname, firstname). I'm using...
|
by: Josué Maldonado |
last post by:
Hello list,
The query has the following in the where:
UPPER(cty_Name) LIKE 'NEW%' ORDER BY cty_name
it returns the data in this way:
Newark
Newark
|
by: Frederik |
last post by:
Hi all,
I'm building a C# application that uses a M$ Acces database. In one of
the queries I use something like the following:
SELECT id FROM mytable WHERE id IN (20, 12, 21, 14)
The result...
|
by: kartik |
last post by:
Hi,
I have a huge table with ID, Name and other info. ID can be either 1
or 2 or 3.
I wish to create a query which sorts the data by ID, but in this order
2,1 and then 3. Is there any way to use...
|
by: vijay |
last post by:
Hello,
As the subject suggests, I need to print the string in the reverse
order. I made the following program:
# include<stdio.h>
struct llnode
{
char *info;
|
by: Boris Zakharin |
last post by:
I have a DataGrid based on a DataSet from an OleDbDataAdapter connected to
an SQL Server 2000. There is a date field in the table I link to and I want
to sort by it in descending order (latest...
|
by: =?Utf-8?B?VmFuZXNzYQ==?= |
last post by:
Here is my loop and it runs fine:
----------------------------------------------------
sSQL = "SELECT * FROM STORE_ITEMS"
Set DataRec = DB.execute(sSQL)
if not DataRec.EOF then
do while not...
|
by: Tom_F |
last post by:
To comp.databases.ms-access --
I am trying to re-number the "tab index" for a large number of
controls on a form. When I try to do this one control at a time,
Access automatically re-numbers...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |