I own a small business. Need to track a few hundred pieces of rental
equipment that can be in any of a few dozen locations. I'm an old-time C
language programmer (UNIX environment). If the only tool you know how to
use is a hammer, every problem tends to look like a nail. That said, I
could solve my problem in C, but it's not the right tool. I need to come
into the Windows world, and I need to get this done in Access or
something similar.
I have made a start in Access, and am making good progress, buy I'm
stymied by a query (or family of queries) that I will need.
I have defined two tables (over-simplified here): Eqpt and Loc for
attributes of the equipment and location, respectively. Primary Keys are
EqptID and LocID.
Since the equipment moves around between locations, I have a third table
with three attributes: EqptID, LocID, and EqLocDate. The date is the
date on which a piece of equipment was placed at a location. I need a
query for this third table.
1. Each piece of equipment will have multiple entries in this table. I
need to find the most recent (latest date) entry for each piece of
equipment. This can then be used to generate a report showing, for each
location, what equipment is currently at that location.
Can anyone help with that query?
Your tables are excellent! Create a query that includes all three tables.
You need the first two to get the equipment name and the location name.
Include the following fields in your query:
EquipName, Locationname, EqLocDate. Click on the Sigma (looks liks capital
E) button in the toolbar at the top of the screen. Under EqLocDate, change
Group By to Max. Run the query and you should get an unique list of
equipment and its current location. Base your report on this query.
You haven't said anything about having a table to record equipment being
returned from rental. This will also need to be included in the above query
because the above query will list all equipment that has ever been rented
and will actually show where it was last rented although it may have been
returned.

Signature
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1150 users have come to me from the newsgroups requesting help
resource@pcdatasheet.com
>I own a small business. Need to track a few hundred pieces of rental
> equipment that can be in any of a few dozen locations. I'm an old-time C
[quoted text clipped - 22 lines]
>
> Can anyone help with that query?
Bob Quintal - 29 Mar 2006 04:05 GMT
> Your tables are excellent! Create a query that includes all
> three tables. You need the first two to get the equipment name
[quoted text clipped - 4 lines]
> and you should get an unique list of equipment and its current
> location. Base your report on this query.
Again, PCD posts incorrect information. Doing this will return
the maximum of EqLocDate for each piece of equipment at each
location., because of the group by under the location.
> You haven't said anything about having a table to record
> equipment being returned from rental. This will also need to
> be included in the above query because the above query will
> list all equipment that has ever been rented and will actually
> show where it was last rented although it may have been
> returned.
That's not necessary, as the equipment not rented out is in
location "Rental Shop"

Signature
Bob Quintal
PA is y I've altered my email address.
Please Stop Advertising - 29 Mar 2006 04:11 GMT
> Your tables are excellent! Create a query that includes all three tables.
> You need the first two to get the equipment name and the location name.
[quoted text clipped - 9 lines]
> and will actually show where it was last rented although it may have been
> returned.

Signature
To anyone reading this thread:
It is commonly accepted that these newsgroups are for free
exchange of information. Please be aware that PC Datasheet
is a notorious job hunter. If you are considering doing
business with him then I suggest that you take a look at
the link below first.
http://home.tiscali.nl/arracom/whoissteve.html
Randy Harris
L. R. Du Broff - 29 Mar 2006 05:29 GMT
> You haven't said anything about having a table to record equipment
> being returned from rental. This will also need to be included in the
> above query because the above query will list all equipment that has
> ever been rented and will actually show where it was last rented
> although it may have been returned.
Not trying to track individual rentals (that's handled separately). What
I need to track is the location where a piece of equipment is currently
assigned, or based. Scenario is, place a piece of equipment a Location
A, where it does it's rental thing for a while. At some point, that
piece of equipment is returned to the warehouse (location 'W') for
service. After being serviced, it becomes a spare, then when needed, it
goes to location B for rental. If you imagine this cycle with a few
hundred pieces of equipment and a few dozen rental locations, it becomes
important to be able to track where each piece of equipment is based.
We visit each rental location at least once a month, and the first thing
we need to do upon arrival is to do a physical inventory of the equipment
at that location. We need to be able to flag missing equipment
accurately, and without false alarms. We have been using spreadsheets to
make the equipment list, but it's obvious that an Access solution is far
better for this task. The spreadsheets are inherited -- bought the
business from someone who had hired a computer "expert" to organize this,
and the "expert consultant" did it with Excel, which leaves a lot to be
desired for this task.
Keith Wilby - 29 Mar 2006 09:34 GMT
> The spreadsheets are inherited -- bought the
> business from someone who had hired a computer "expert" to organize this,
> and the "expert consultant" did it with Excel, which leaves a lot to be
> desired for this task.
Was his name Steve and were his fees very reasonable?
;-)
Keith.
L. R. Du Broff - 29 Mar 2006 13:44 GMT
>> The spreadsheets are inherited -- bought the
>> business from someone who had hired a computer "expert" to organize
[quoted text clipped - 6 lines]
>
> Keith.
Don't know his name, but I'm told that his expertise was available for
$10.00 (that's TEN) dollars an hour.
Keith Wilby - 29 Mar 2006 14:21 GMT
>> Was his name Steve and were his fees very reasonable?
>
> Don't know his name, but I'm told that his expertise was available for
> $10.00 (that's TEN) dollars an hour.
Sorry, it was a bit of an in-joke at the expense of a regular AUP-breaker on
here. :-)
Keith.
Larry Linson - 30 Mar 2006 18:16 GMT
>>> the "expert consultant" did it with Excel, which leaves a
>>> lot to be desired for this task.
>> Was his name Steve and were his fees very reasonable?
>
> Don't know his name, but I'm told that his expertise
> was available for $10.00 (that's TEN) dollars an hour.
<SARCASM> What a wonderful bargain! I can't even get my lawn mowed for
$10.00 (that's TEN) dollars an hour. </SARCASM>
<VOICE OF EXPERIENCE> Beware any who represent themselves as "expert" and
offer to sell their expertise for $10.00 per hour. </VOICE OF EXPERIENCE>
Larry Linson
Microsoft Access MVP
PC D - 31 Mar 2006 01:15 GMT
The previous owner hired Arno R as an "Expert" and the previous owner
learned the hardway about Arno R!
PC D
>>> The spreadsheets are inherited -- bought the
>>> business from someone who had hired a computer "expert" to organize
[quoted text clipped - 9 lines]
> Don't know his name, but I'm told that his expertise was available for
> $10.00 (that's TEN) dollars an hour.
> I own a small business. Need to track a few hundred pieces of
> rental equipment that can be in any of a few dozen locations.
[quoted text clipped - 26 lines]
>
> Can anyone help with that query?
What you need is a query nested within another query
the inner one first. SELECT top 1 two.locID FROM [third table]
ALIAS two WHERE two.eqptid = eqpt.eqptID ORDER BY EqLocDate DESC
the outer query is
SELECT EqptID,(x) as CurrentLoc from eqpt ORDER BY CurrentLoc
where x is the inner query,
Nested you get
SELECT EqptID,(SELECT top 1 two.locID FROM [third table] ALIAS
two WHERE two.eqptid = eqpt.eqptID ORDER BY EqLocDate DESC) as
CurrentLoc from eqpt ORDER BY CurrentLoc; .
Change [third table] to the real name of your third table.

Signature
Bob Quintal
PA is y I've altered my email address.