Query question regarding weeks

R

ryan.fitzpatrick3

I have a query where it downloads information out of our database.
This database has volumes of items in weeks instead of days. so the
format would be 200801 for 2008 week 1, 200802, 200803, etc etc. Now I
want the last or most current week in the table, so I tried doing last
or max to get 200824, since we are in the 24th week of the year. The
table would look like this

item# item name quantity week
112345 shoes 100 200801
112345 shoes 56 200802
112345 shoes 112 200803

etc
etc

for all items.

How can I get it just to reflect the current week we are in only? I
know I can type 200824 in the criteria and that will work but in 3
months from now when its week 200832 I don't want to manually type in
200832 or whatever week it is in. Like I mentioned above when I used
last or max, it pulls the last or max of each week since they are
different.

Ryan
 
M

Marshall Barton

I have a query where it downloads information out of our database.
This database has volumes of items in weeks instead of days. so the
format would be 200801 for 2008 week 1, 200802, 200803, etc etc. Now I
want the last or most current week in the table, so I tried doing last
or max to get 200824, since we are in the 24th week of the year. The
table would look like this

item# item name quantity week
112345 shoes 100 200801
112345 shoes 56 200802
112345 shoes 112 200803

etc
etc

for all items.

How can I get it just to reflect the current week we are in only? I
know I can type 200824 in the criteria and that will work but in 3
months from now when its week 200832 I don't want to manually type in
200832 or whatever week it is in. Like I mentioned above when I used
last or max, it pulls the last or max of each week since they are
different.


You can set the query's week field's criteria to something
like:
=(SELECT Max(X.week) FROM table As X)
 
R

ryan.fitzpatrick3

When I copy and paste the code in, am I to change any of the code to
reflect anything of mine, like the table? Also when I copy and paste
and run the query is pops up an input box with X.weeks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Adding monthly records to quarterly 2
Crosstab Query Column headings 4
grouping up date data 1
Graph Column Headings 7
Comparing Weeks 1
Last Week, 2 Weeks ago... 2
crosstab query? 12
Query/SQL+VBA 5

Top