Showing Last Record

  • Thread starter Thread starter Kat
  • Start date Start date
K

Kat

I have a database that I use to log phone calls. I need to find a way to
show my last phone call for a certain record. The relationship between the
two tables are one to many. I don't know what I need to do to create this
report.

Tables :
CallLog
OrderTbl

Primary Key:
None

Field:

Order Number
Date
Note

Can anyone help.
 
Kat

"insufficient information..."

You mentioned (?) two tables. Which is the "one" and which is the "many"?

You mentioned fields. Which table(s) have those fields?

By the way, you mentioned that one of your fields is named "Date". Access
has a bunch of "reserved words" that it uses ... and "date" is one of those.
What YOU mean when you say "date" and what Access hears may not be the same.

The usual solution is to modify the title of that field, perhaps to
something like "CallDate".

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Kat,

Assuming that what you want is to get the most recent call from CallLog, for
a particular Order, and that your CallLog table contains fields similar to
(LogID, LogDateTime, OrderID, ...)

Then your query might look like:

SELECT CallLog.*
FROM CallLog
WHERE CallLog.OrderID = [Order #]
AND CallLog.CallDateTime = (SELECT Max(CallDateTime) as LastCall
FROM CallLog
WHERE OrderID = [Order #])


If you want this in a report, you might want to create a query that looks
something like:

SELECT OrderID, Max(CallDateTime) as LastOrderCall
FROM CallLog
GROUP BY OrderID

Then you can join this query to your CallLog table by both of these fields
to get the last call for each OrderID.

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
Back
Top