Access Querry Only Display Last Record

Experts:

I have a certain Query in my Access Database.

I only want this Query to display fields from the last record updated to it.  What’s the best way to make this happen?

Thanks.
mdstallaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Eric ShermanAccountant/DeveloperCommented:
<<<I only want this Query to display fields from the last record updated to it.>>>

Do you mean last record added to the table???
0
Eric ShermanAccountant/DeveloperCommented:
If you are referring to the last record added and you have an ID field that uniquely identifies each record then ...

SELECT [tblYourTable].*
FROM [tblYourTable]
WHERE ((([tblYourTable].ID)=DMax("ID","[tblYourTable]")));

ET
0
mdstallaAuthor Commented:
ET:

Yes, I mean the last record added to a Table.  

The Table is called TblInterviewMain and the Unique ID is called InterviewID.  How would this code look now that you have that information?

Also, where do I place the code you provided?  Can you walk me through how to open up the appropriate VBA Code screen where I should drop this code?

Sorry—I'm a bit of an Access Rookie!

Thanks for your help.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Eric ShermanAccountant/DeveloperCommented:
The code I posted is not VBA ... It is the SQL for you query.

Just replace tblYourTable with your table name or better yet load up a sample of your database.  That will make it easier to work with.

ET
0
mdstallaAuthor Commented:
Your code needed a little adjusting, but I got it to work (that you for getting my 90% there).

 WHERE ((([tblYourTable].ID)=DMax("ID","[tblYourTable]")));

Needed to be changed to:

WHERE (((tblInterviewMain.[InterviewID])=DMax("InterviewID","[tblInterviewMain]")));

I've got another similar one for you... just let me know if you want me to close this out and open a new ticket:

Do you have an SQL code that will force my Query to display only the 1st (top) record that appears on it's list?

Note:  My Querry is already programed to order its list by 'which record received the last change/update to one of its fields.'
0
Eric ShermanAccountant/DeveloperCommented:
Yes, that would be a separate question.

<<<<<Your code needed a little adjusting, but I got it to work (that you for getting my 90% there).
  WHERE ((([tblYourTable].ID)=DMax("ID","[tblYourTable]")));
 Needed to be changed to:
 WHERE (((tblInterviewMain.[InterviewID])=DMax("InterviewID","[tblInterviewMain]")));>>>>>

Well ... I think my solution answered your question 100% since I have no way of knowing what the table and field names are.  They were not provided in you original question.  :-)

ET
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mdstallaAuthor Commented:
Thanks for all of your help E!
0
Eric ShermanAccountant/DeveloperCommented:
Ok, glad it worked out for you.

ET
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.