472,950 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,950 software developers and data experts.

A97 table design?

MLH
If I open an A97 table, resort its key-field to descending order and
attempt to close the table, A97 asks me if I wish to save the table
DESIGN? Now really, I don't think the table design is being saved
at all. If so, how does one explain these facts:

1) say I do click Yes to save the table design
2) later I open the table manually and, sure enough, key field is
shown in descending order
3) I run this in debug window... ?DLookup("[KeyField]", "MyTable")

Step 3 returns the value of the FIRST actual record ever entered
into the table - not the last. Obviously, if fundamental table DESIGN
had been saved as implied by the A97 prompt, the last would-a-been
shown. So, A97 is NOT saving a modified version of table design, is
it? Its merely saving a query filter sort. Sound about right?
Nov 13 '05 #1
6 1660
Only the table's OrderBy property is being saved.

By definition, records are unordered in a relational database. The fact that
Access presents them in primary key order by default is understandable, but
it is outside of what a relational database should do.

A major weakness with DLookup() is that you cannot specify a sort order,
i.e. you take pot luck as to which record is returned if there are multiple
matches. For an extended replacement of DLookup() that solves that problem
by letting you specify the retrieval order, see:
http://allenbrowne.com/ser-42.html

--
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.

"MLH" <CR**@NorthState.net> wrote in message
news:2l********************************@4ax.com...
If I open an A97 table, resort its key-field to descending order and
attempt to close the table, A97 asks me if I wish to save the table
DESIGN? Now really, I don't think the table design is being saved
at all. If so, how does one explain these facts:

1) say I do click Yes to save the table design
2) later I open the table manually and, sure enough, key field is
shown in descending order
3) I run this in debug window... ?DLookup("[KeyField]", "MyTable")

Step 3 returns the value of the FIRST actual record ever entered
into the table - not the last. Obviously, if fundamental table DESIGN
had been saved as implied by the A97 prompt, the last would-a-been
shown. So, A97 is NOT saving a modified version of table design, is
it? Its merely saving a query filter sort. Sound about right?

Nov 13 '05 #2
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in
news:42***********************@per-qv1-newsreader-01.iinet.net.au:
A major weakness with DLookup() is that you cannot specify a sort
order, i.e. you take pot luck as to which record is returned if
there are multiple matches. For an extended replacement of
DLookup() that solves that problem by letting you specify the
retrieval order, see:
http://allenbrowne.com/ser-42.html


Pardon me, but isn't that a mis-use of DLookup(), to request
criteria that return more than one value? Isn't that really more
like a DFirst() function?

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #3
David, I'm sure you know that DLookup() will work where the return value is
non-unique, so I understand you to mean that it's not a sensible thing to do
since the return value is undefined/unreliable. Fair enough (though there
are certainly cases where it does make sense, e.g. get me an invoice for
client 54--I don't care which one.)

DFirst() doesn't solve the problem I'm addressing.
None of the domain aggregate functions can answer this:
What is the most recent InvoiceID for Client 54?
where "most recent" is defined by the InvoiceDate.

If we had an extra optional argument for DLookup() to specify the sort
order, you could do that easily:
DLookup("InvoiceID", "tblInvoice", "ClientID=54", "InvoiceDate DESC")
I actully requsted MS to add this feature, arguning that an optional extra
argument breaks no existing code, and would very useful. It didn't happen,
so I wrote a replacement function that does it.

Actually, that looks incredibly obvious to me, as the arguments match your
basic SQL statement:
SELECT Arg1 FROM Arg2 [WHERE Arg3] [ORDER BY Arg4]

--
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.

"David W. Fenton" <dX********@bway.net.invalid> wrote in message
news:Xn*********************************@216.196.9 7.142...
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in
news:42***********************@per-qv1-newsreader-01.iinet.net.au:
A major weakness with DLookup() is that you cannot specify a sort
order, i.e. you take pot luck as to which record is returned if
there are multiple matches. For an extended replacement of
DLookup() that solves that problem by letting you specify the
retrieval order, see:
http://allenbrowne.com/ser-42.html


Pardon me, but isn't that a mis-use of DLookup(), to request
criteria that return more than one value? Isn't that really more
like a DFirst() function?

Nov 13 '05 #4
Allen Browne wrote:
Actually, that looks incredibly obvious to me, as the arguments match your
basic SQL statement:
SELECT Arg1 FROM Arg2 [WHERE Arg3] [ORDER BY Arg4]


my tLookup can do the same, e.g.

tLookup("field","table","field2='whatever' order by field3 desc")

;-)
Nov 13 '05 #5
And yours has been around longer, Trevor.

BTW, you don't provide the link to your site in your sig?
Maybe that's what "Windows is searching" was all about. :-)

--
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.

"Trevor Best" <no****@nospam.invalid> wrote in message
news:42***********************@news.zen.co.uk...
Allen Browne wrote:
Actually, that looks incredibly obvious to me, as the arguments match
your basic SQL statement:
SELECT Arg1 FROM Arg2 [WHERE Arg3] [ORDER BY Arg4]


my tLookup can do the same, e.g.

tLookup("field","table","field2='whatever' order by field3 desc")

;-)

Nov 13 '05 #6
Allen Browne wrote:
And yours has been around longer, Trevor.

BTW, you don't provide the link to your site in your sig?
Maybe that's what "Windows is searching" was all about. :-)


What sig? <g>

My trusty old Soundblaster went pop and took Windows out with it so no
sig at all ATM until I get around to setting one up again.

I used to have a link about 7 years ago, about the time I last updated
the site :-)
Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael Lauzon | last post by:
This is not for a class, I have a group on SourceForge, this is what one of the Developers is asking; the more advanced you can make it right off all the better!: Can someone please create...
47
by: Neal | last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A quite good article.
0
by: 2trax | last post by:
Hi all, I am trying to mimic the unix security model (users and groups) in a web app. I have thought of two ways of implementing this, but am unsure which would be better. The first design...
15
by: kimi | last post by:
I have just started working on a project that is partially complete. It is an application that is using access to store test results. The test results are being stored in two Access 2000 databases....
4
by: Nathan Sokalski | last post by:
When editing an ASP Table, Visual Studio does not allow me to edit it in Design View. This makes it harder to add elements, because I must add every element either by using Design View to create...
7
by: david | last post by:
I have asked this question before. But it does not work for me. Given radion buttons in the web form design page. What I did is described as follows. A panel control is dragged into the design...
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
4
by: yanjie.ma | last post by:
Hi, I've got a two part question on table and form design (sorry for the length but it takes a bit to explain). Our sales department uses a look-up table to help the them select the best...
54
by: csolomon | last post by:
Hello: I was wondering if I could get some input on how to address a design issue, involving my composite table. I have one portion of my project complete. The following forms and reports I...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 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...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
isladogs
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...
0
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...
0
tracyyun
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...
2
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...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
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...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.