Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 342
  • Last Modified:

How query only the THREE most recent records in a table

I am using query designer to attempt to select only the most recent THREE records in a table.  

Can this be done?
0
SteveL13
Asked:
SteveL13
  • 2
  • 2
1 Solution
 
Rey Obrero (Capricorn1)Commented:
if you have an autonumber field this will do it

select top 3 * from TableName
Order by [autonumberfield name] desc
0
 
SteveL13Author Commented:
Once again I didn't explain the challenge very well.

I need to select the most recent three records from tblOpenOrders where Part_No = Forms!frmOpenOrders!txtPart_No

What should the SQL be for this?
0
 
SteveL13Author Commented:
And the records in tblOpenOrders do have an autonumber record ID number.
0
 
Rey Obrero (Capricorn1)Commented:
try this

select top 3 * from  tblOpenOrders
where tblOpenOrders.Part_No = Forms!frmOpenOrders!txtPart_No
Order by [record ID] desc
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now