dbTalk Databases Forums  

Query

comp.databases.ms-access comp.databases.ms-access


Discuss Query in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rodjk #613
 
Posts: n/a

Default Query - 01-11-2009 , 05:53 PM






Hello,
I am trying to help get a query to work in Access 2003.
There is one table, Engineering Document Register.
In it are various columns, but only three are needed for this query.
Doc No (Document Number) XMTL Ref (Transmittal reference number) and
Issued.

The database will have the same Doc No used several times, and the
XMTL Ref number is used for more than one document. But each document
will only be listed in XMTL Ref only once.
Issued is the date that the XMTL Ref went out, so the date is not
unique.

What I need to do is make a query that will pull the latest date that
the document was transmitted.
Can this be done?

Thanks,
Rodjk #613

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Query - 01-11-2009 , 06:56 PM






Rodjk #613 wrote:

Quote:
Hello,
I am trying to help get a query to work in Access 2003.
There is one table, Engineering Document Register.
In it are various columns, but only three are needed for this query.
Doc No (Document Number) XMTL Ref (Transmittal reference number) and
Issued.

The database will have the same Doc No used several times, and the
XMTL Ref number is used for more than one document. But each document
will only be listed in XMTL Ref only once.
Issued is the date that the XMTL Ref went out, so the date is not
unique.

What I need to do is make a query that will pull the latest date that
the document was transmitted.
Can this be done?

Thanks,
Rodjk #613
Query/Design/New, add table Engineering Document Register, then press Close.

Drag down from table to a column the field DocNumber. Drag Issued to
another column. Click from the menu View/Totals. Under Issued column
select Max. Run the query.


Reply With Quote
  #3  
Old   
Rodjk #613
 
Posts: n/a

Default Re: Query - 01-11-2009 , 07:21 PM



On Jan 11, 6:56*pm, Salad <o... (AT) vinegar (DOT) com> wrote:
Quote:
Rodjk #613 wrote:
Hello,
I am trying to help get a query to work in Access 2003.
There is one table, Engineering Document Register.
In it are various columns, but only three are needed for this query.
Doc No (Document Number) XMTL Ref (Transmittal reference number) and
Issued.

The database will have the same Doc No used several times, and the
XMTL Ref number is used for more than one document. But each document
will only be listed in XMTL Ref only once.
Issued is the date that the XMTL Ref went out, so the date is not
unique.

What I need to do is make a query that will pull the latest date that
the document was transmitted.
Can this be done?

Thanks,
Rodjk #613

Query/Design/New, add table Engineering Document Register, then press Close.

Drag down from table to a column the field DocNumber. *Drag Issued to
another column. *Click from the menu View/Totals. *Under Issued column
select Max. *Run the query.
Thanks for the reply.
When I try this, it brings up duplicate Doc No entries.

What I am trying to do is set this so that when someone clicks on the
query, they get a pop up window asking for a Doc No. They put in the
number and get the most recent XMTL number and date.

Thanks again, any and all help is appreciated.

Rodjk #613


Reply With Quote
  #4  
Old   
rkc
 
Posts: n/a

Default Re: Query - 01-12-2009 , 08:07 AM



On Jan 11, 6:53*pm, "Rodjk #613" <rjka... (AT) gmail (DOT) com> wrote:
Quote:
Hello,
I am trying to help get a query to work in Access 2003.
There is one table, Engineering Document Register.
In it are various columns, but only three are needed for this query.
Doc No (Document Number) XMTL Ref (Transmittal reference number) and
Issued.

The database will have the same Doc No used several times, and the
XMTL Ref number is used for more than one document. But each document
will only be listed in XMTL Ref only once.
Issued is the date that the XMTL Ref went out, so the date is not
unique.

What I need to do is make a query that will pull the latest date that
the document was transmitted.
Can this be done?

Thanks,
Rodjk #613
So any one combination of XMLT and DocNo will be unique, but
that's irrelevant because all you really want is the latest
IssuedDate
for a DocNo.

SELECT dr.DocNo, dr.XMTLRef, dr.DateIssued
FROM DocRegister AS dr
WHERE dr.DateIssued In
(SELECT Max(DateIssued) From DocRegister
WHERE DocNo = dr.DocNo)
AND dr.DocNo = ?


Reply With Quote
  #5  
Old   
rkc
 
Posts: n/a

Default Re: Query - 01-12-2009 , 08:44 AM



On Jan 12, 9:07*am, rkc <r... (AT) rkcny (DOT) com> wrote:
Quote:
On Jan 11, 6:53*pm, "Rodjk #613" <rjka... (AT) gmail (DOT) com> wrote:



Hello,
I am trying to help get a query to work in Access 2003.
There is one table, Engineering Document Register.
In it are various columns, but only three are needed for this query.
Doc No (Document Number) XMTL Ref (Transmittal reference number) and
Issued.

The database will have the same Doc No used several times, and the
XMTL Ref number is used for more than one document. But each document
will only be listed in XMTL Ref only once.
Issued is the date that the XMTL Ref went out, so the date is not
unique.

What I need to do is make a query that will pull the latest date that
the document was transmitted.
Can this be done?

Thanks,
Rodjk #613

So any one combination of XMLT and DocNo will be unique, but
that's irrelevant because all you really want is the latest
IssuedDate
for a DocNo.

SELECT dr.DocNo, dr.XMTLRef, dr.DateIssued
FROM DocRegister AS dr
WHERE dr.DateIssued In
(SELECT Max(DateIssued) From DocRegister
WHERE DocNo = dr.DocNo)
AND dr.DocNo = ?
or...

SELECT Top 1 DocNo, XMTLRef, DateIssued
FROM DocRegister
WHERE DocNo = ?
Order By DateIssued Desc


Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.