A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Limit recordset to top 1 per group



 
 
Thread Tools Display Modes
  #21  
Old February 23rd, 2009, 12:08 PM posted to microsoft.public.access.queries
BruceM[_2_]
external usenet poster
 
Posts: 1,763
Default Limit recordset to top 1 per group

Worst part was I didn't learn about it until after the initial build. I
guess it's one of those things they started doing at some point, and it
became part of the system without a deliberate plan.
Thanks again for your interest in the problem and the thought you have
devoted to helping me sort it out.

"Marshall Barton" wrote in message
...
That sure does sound like an odd accounting approach, but I
guess you have it under control. Good luck with the next
problem ;-)
--
Marsh
MVP [MS Access]


BruceM wrote:
A revised PO, unlike a new requisition record, starts with a PO_Number,
but
unlike a "standard" PO it has not been approved. Therefore when the
personnel who do approvals review records that need approval, they need to
see the unapproved revised POs as well as unapproved requisitions
(PO_Number
not yet assigned). Seems a cumbersome accounting approach, but that's how
they do it. The default recordset when the PO form is opened is all
records
that need at least one approval.
I see the logic of doing away with the Nz in the Where condition. I tried
your longer version that tests for equivalency and null, and it seems to
work (although I have not tested thoroughly yet).

"Marshall Barton" wrote
BruceM wrote:

I will take a careful look at the code to be sure I am using Nz only
where
it is needed. It is definitely needed to increment PO_Rev if the first
version of a PO has PO_Rev null and the first revision (second version)
has
it at 1. It is also needed for the comparison I mentioned earlier in
the
thread where I want to include records in which the PO_Number is null:
WHERE Nz(tblPO.PO_Number,0) = Nz(P2.PO_Number,0)


I think I might disagree with using Nz(tblPO.PO_Number,0) =
Nz(P2.PO_Number,0). That kind of looks like you are linking
details to an unapproved PO that has no POnum. If an
unapproved PO can have details, then it seems to me that
they would have to be linked on some other field. The way
you have it, it seems like it would connect all the details
of every unapproved PO to each unapproved PO.

That Nz expression could also be done by using the condition

((tblPO.PO_Number = P2.PO_Number) OR (tblPO.PO_Number Is
Null And P2.PO_Number Is Null))

which may be more cumbersom to write, but at least has a
chance of using index optimizations. But, as I said above I
just don't understand how this accomplishes anything useful.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:16 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.