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  

Need help with a date on a querie, please!!!



 
 
Thread Tools Display Modes
  #1  
Old September 3rd, 2008, 05:20 PM posted to microsoft.public.access.queries
Cesar Urquidi[_2_]
external usenet poster
 
Posts: 23
Default Need help with a date on a querie, please!!!

I have an "Equipment" table and an "Issue/Return" table:

Equipment:
l_ Device ID _l_ Device Description _l

Issue/Return:
l_ Issue/Return ID _l_ Device ID _l_ Issue To _l_ Issue Date _l

I created a form from the "Equipment" table with a subform in the bottom
using the "Issue/Return".

Every time I issue a piece of equipment to somebody, I enter it in the
"Issue/Return" subform.

I want to create a querie using both tables and be able to display only the
latest record of each piece of equipment that I issued, using a formula in
the "Issue Date" field.

Tha formula has to say something like: show only latest issue date from
"device id".

What formula do I need to enter in the querie???

--
Thank you,
Cesar Urquidi
  #2  
Old September 3rd, 2008, 06:03 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Need help with a date on a querie, please!!!

Cesar Urquidi wrote:

I have an "Equipment" table and an "Issue/Return" table:

Equipment:
l_ Device ID _l_ Device Description _l

Issue/Return:
l_ Issue/Return ID _l_ Device ID _l_ Issue To _l_ Issue Date _l

I created a form from the "Equipment" table with a subform in the bottom
using the "Issue/Return".

Every time I issue a piece of equipment to somebody, I enter it in the
"Issue/Return" subform.

I want to create a querie using both tables and be able to display only the
latest record of each piece of equipment that I issued, using a formula in
the "Issue Date" field.

Tha formula has to say something like: show only latest issue date from
"device id".



SELECT IR.*, E.[Device Description]
FROM Equipment As E INNER JOIN [Issue/Return] As IR
ON IR.[Device ID] = E.[Device ID]
WHERE IR.[Issue Date] = (SELECT Max(X.[Issue Date]
FROM [Issue/Return] As X
WHERE X.[Device ID] = IR.[Device ID])
--
Marsh
MVP [MS Access]
  #3  
Old September 3rd, 2008, 07:06 PM posted to microsoft.public.access.queries
Cesar Urquidi[_2_]
external usenet poster
 
Posts: 23
Default Need help with a date on a querie, please!!!

Hello,
I don't understand!
I created the querie.
Can you please tell me the criteria I need to enter in the design view of
the querie?
--
Thank you,
Cesar Urquidi


"Marshall Barton" wrote:

Cesar Urquidi wrote:

I have an "Equipment" table and an "Issue/Return" table:

Equipment:
l_ Device ID _l_ Device Description _l

Issue/Return:
l_ Issue/Return ID _l_ Device ID _l_ Issue To _l_ Issue Date _l

I created a form from the "Equipment" table with a subform in the bottom
using the "Issue/Return".

Every time I issue a piece of equipment to somebody, I enter it in the
"Issue/Return" subform.

I want to create a querie using both tables and be able to display only the
latest record of each piece of equipment that I issued, using a formula in
the "Issue Date" field.

Tha formula has to say something like: show only latest issue date from
"device id".



SELECT IR.*, E.[Device Description]
FROM Equipment As E INNER JOIN [Issue/Return] As IR
ON IR.[Device ID] = E.[Device ID]
WHERE IR.[Issue Date] = (SELECT Max(X.[Issue Date]
FROM [Issue/Return] As X
WHERE X.[Device ID] = IR.[Device ID])
--
Marsh
MVP [MS Access]

  #4  
Old September 3rd, 2008, 09:14 PM posted to microsoft.public.access.queries
Lord Kelvan
external usenet poster
 
Posts: 637
Default Need help with a date on a querie, please!!!

that is an sql statement what you do is open a new query then click on
view in the menu bar and then click on sql view then paste

SELECT IR.*, E.[Device Description]
FROM Equipment As E INNER JOIN [Issue/Return] As IR
ON IR.[Device ID] = E.[Device ID]
WHERE IR.[Issue Date] = (
SELECT Max(X.[Issue Date]
FROM [Issue/Return] As X
WHERE X.[Device ID] = IR.[Device ID])


after deleting all text that in in that window then you have to run
the query

Regards
Kelvan
  #5  
Old September 3rd, 2008, 10:08 PM posted to microsoft.public.access.queries
Cesar Urquidi[_2_]
external usenet poster
 
Posts: 23
Default Need help with a date on a querie, please!!!

Hello Kelvan,
I tried it, didn't work!!!!!!!!!!!!!!!!!!

I get the following message:

Missing ), ], or Item in query expression 'IR.[Issue Date] = (
SELECT Max(X.[Issue Date]
FROM [Issue/Return] As X
WHERE X.[Device ID] = IR.[Device ID]'.

Please help me!!!
Please just send me the criteria I need to use!!!

--
Thank you,
Cesar Urquidi


"Lord Kelvan" wrote:

that is an sql statement what you do is open a new query then click on
view in the menu bar and then click on sql view then paste

SELECT IR.*, E.[Device Description]
FROM Equipment As E INNER JOIN [Issue/Return] As IR
ON IR.[Device ID] = E.[Device ID]
WHERE IR.[Issue Date] = (
SELECT Max(X.[Issue Date]
FROM [Issue/Return] As X
WHERE X.[Device ID] = IR.[Device ID])


after deleting all text that in in that window then you have to run
the query

Regards
Kelvan

  #6  
Old September 3rd, 2008, 10:20 PM posted to microsoft.public.access.queries
Lord Kelvan
external usenet poster
 
Posts: 637
Default Need help with a date on a querie, please!!!

to be honest i dont know i havent read the post just helped you
understand that marshall wrote

(SELECT Max(X.[Issue Date] FROM [Issue/Return] As X WHERE X.[Device
ID] = IR.[Device ID])

should be the criteria for the issue date box

SELECT IR.*, E.[Device Description]
FROM Equipment As E INNER JOIN [Issue/Return] As IR
ON IR.[Device ID] = E.[Device ID]
WHERE IR.[Issue Date] = (
SELECT Max(X.[Issue Date]
FROM [Issue/Return] As X
WHERE X.[Device ID] = IR.[Device ID]))

that is the sql seems marshall just missed a ) at the end

IF THE CRITERIA ABOVE DOSNT WORK try the sql

hope this helps

Regards
Kelvan
  #7  
Old September 3rd, 2008, 10:38 PM posted to microsoft.public.access.queries
Cesar Urquidi[_2_]
external usenet poster
 
Posts: 23
Default Need help with a date on a querie, please!!!

Hello Kelvan/Marshall,
Please read the post from the beginning and help me figure it out.
--
Thank you,
Cesar Urquidi


"Lord Kelvan" wrote:

to be honest i dont know i havent read the post just helped you
understand that marshall wrote

(SELECT Max(X.[Issue Date] FROM [Issue/Return] As X WHERE X.[Device
ID] = IR.[Device ID])

should be the criteria for the issue date box

SELECT IR.*, E.[Device Description]
FROM Equipment As E INNER JOIN [Issue/Return] As IR
ON IR.[Device ID] = E.[Device ID]
WHERE IR.[Issue Date] = (
SELECT Max(X.[Issue Date]
FROM [Issue/Return] As X
WHERE X.[Device ID] = IR.[Device ID]))

that is the sql seems marshall just missed a ) at the end

IF THE CRITERIA ABOVE DOSNT WORK try the sql

hope this helps

Regards
Kelvan

  #8  
Old September 3rd, 2008, 10:46 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Need help with a date on a querie, please!!!

Cesar Urquidi wrote:
I don't understand!
I created the querie.
Can you please tell me the criteria I need to enter in the design view of
the querie?



The criteria is the subquery.

If you would Copy/Paste the SQL I posted into a new query's
SQL view (and change to the names of your table/fields),
then you can switch to design view to see what it looks like
in the query designer.

--
Marsh
MVP [MS Access]
  #9  
Old September 3rd, 2008, 10:47 PM posted to microsoft.public.access.queries
Lord Kelvan
external usenet poster
 
Posts: 637
Default Need help with a date on a querie, please!!!

i read it and i read marshalls sql and it shoudl do the job

just open a query then click on view then sql view and replace what it
there with

SELECT IR.*, E.[Device Description]
FROM Equipment As E INNER JOIN [Issue/Return] As IR
ON IR.[Device ID] = E.[Device ID]
WHERE IR.[Issue Date] = (
SELECT Max(X.[Issue Date]
FROM [Issue/Return] As X
WHERE X.[Device ID] = IR.[Device ID]))

what you want is not simple it is quite complex so you need to do it
from the sql view after you have entered it in then you can edit it in
design view but paste the above sql

regards
Kelvan
  #10  
Old September 4th, 2008, 12:07 AM posted to microsoft.public.access.queries
Cesar Urquidi[_2_]
external usenet poster
 
Posts: 23
Default Need help with a date on a querie, please!!!

It wooooooooorked!!!

Thank you Marshall!
Thank you Kelvan!
--
Thank you,
Cesar Urquidi


"Marshall Barton" wrote:

Cesar Urquidi wrote:
I don't understand!
I created the querie.
Can you please tell me the criteria I need to enter in the design view of
the querie?



The criteria is the subquery.

If you would Copy/Paste the SQL I posted into a new query's
SQL view (and change to the names of your table/fields),
then you can switch to design view to see what it looks like
in the query designer.

--
Marsh
MVP [MS Access]

 




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 12:51 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.