Connecting Tech Pros Worldwide Help | Site Map

Finding Latest Record for an Associate

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 05:17 PM
John Baker
Guest
 
Posts: n/a
Default Finding Latest Record for an Associate

Hi:

I have used this group a number of times simply because while the manuals for Access may
show the technology, but most are really weak on how to apply it in special situations and
the indexes are less that complete!. This is also the first real application iI have
developed for Access, although I have done a number in Lotus Approach.


I have a table with information on how an Associate is to be handled under a specific
Purchase Order for services, and how he/she is to be allocated and tracjed withing the
project. For reasons I wont go into, however, this becomes complicated quickley.

There may be multiple record for an associate under a PO in this table, and there could be
more than one record for the latest date span. I want to select the latest (first) record
for each associates under a given purchase order, and am having trouble doing it with a
query (I am not an SQL maven).

The fields of interest are PO number; Associate ID; Start Date; End Date. My challenge is
to find the first record for each Associated and PO in a data groupings.

Putting the records in order by PO; Associate; Start Date; End Date is a begtinning, but
at that point I get stuck. Suggestions would be appreciated.

I also would like to be able to validate to ensure that (unless an exceptional condition
identified by a yes/no switch exists) there are no duplicate from through dates for an
associated (this would be a different query).

Any help anyone could give with either of these troublesome issues would be much
appreciated.

Regards

John Baker

  #2  
Old November 12th, 2005, 05:17 PM
Allen Browne
Guest
 
Posts: n/a
Default Re: Finding Latest Record for an Associate

See:
Queries: Getting a related field from a GroupBy (total) query
at:
http://www.mvps.org/access/queries/qry0020.htm

The article discusses 4 solutions. The subquery will probably be the most
useful.

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

"John Baker" <Baker.JH@Verizon.net> wrote in message
news:g81ruv0rmmd2k6810bae5mppi7vvbqb7dq@4ax.com...[color=blue]
>
> I have used this group a number of times simply because while the manuals[/color]
for Access may[color=blue]
> show the technology, but most are really weak on how to apply it in[/color]
special situations and[color=blue]
> the indexes are less that complete!. This is also the first real[/color]
application iI have[color=blue]
> developed for Access, although I have done a number in Lotus Approach.
>
>
> I have a table with information on how an Associate is to be handled under[/color]
a specific[color=blue]
> Purchase Order for services, and how he/she is to be allocated and tracjed[/color]
withing the[color=blue]
> project. For reasons I wont go into, however, this becomes complicated[/color]
quickley.[color=blue]
>
> There may be multiple record for an associate under a PO in this table,[/color]
and there could be[color=blue]
> more than one record for the latest date span. I want to select the latest[/color]
(first) record[color=blue]
> for each associates under a given purchase order, and am having trouble[/color]
doing it with a[color=blue]
> query (I am not an SQL maven).
>
> The fields of interest are PO number; Associate ID; Start Date; End Date.[/color]
My challenge is[color=blue]
> to find the first record for each Associated and PO in a data groupings.
>
> Putting the records in order by PO; Associate; Start Date; End Date is a[/color]
begtinning, but[color=blue]
> at that point I get stuck. Suggestions would be appreciated.
>
> I also would like to be able to validate to ensure that (unless an[/color]
exceptional condition[color=blue]
> identified by a yes/no switch exists) there are no duplicate from through[/color]
dates for an[color=blue]
> associated (this would be a different query).
>
> Any help anyone could give with either of these troublesome issues would[/color]
be much[color=blue]
> appreciated.
>
> Regards
>
> John Baker[/color]


  #3  
Old November 12th, 2005, 05:17 PM
Allen Browne
Guest
 
Posts: n/a
Default Re: Finding Latest Record for an Associate

Use a Totals query to GROUP BY whatever makes a duplicate, and COUNT the
primary key. Set Criteria on the Count of primary key to:[color=blue]
> 1[/color]

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

"John Baker" <Baker.JH@Verizon.net> wrote in message
news:g81ruv0rmmd2k6810bae5mppi7vvbqb7dq@4ax.com...[color=blue]
>
> I also would like to be able to validate to ensure that (unless an[/color]
exceptional condition[color=blue]
> identified by a yes/no switch exists) there are no duplicate from through[/color]
dates for an[color=blue]
> associated (this would be a different query).
>
> Any help anyone could give with either of these troublesome issues would[/color]
be much[color=blue]
> appreciated.
>
> Regards
>
> John Baker[/color]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.