Show last 5 records in subform in Access

I have 2 tables

Table 1: FWareHouse ( MainForm)

Table 2: FWHs Inbounds (Subform)
Fiscal Year
Week ID

in the subform i have a code

ON Load:
Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
End Sub
It will go the last row of the subform for a new record to enter

I want to show the last 5 records for the selected FWarehouse from MainForm
were it shows the list  in subform in the order of  Fiscal Year, Week ID ( only last 5 records)
Who is Participating?
bgrandjeanConnect With a Mentor Commented:
sort the record source for the subform as descending for the two fields you are concerned with then to the properties for the query and set Top Values to 5
Dale FyeCommented:
Change the recordsource of the subform to a query that looks like:

SELECT Top 5 FWarehouse, [Fiscal Year], [Week ID], Cases, Weight, XDock
FROM yourTable
WHERE [FWarehouse] = Forms!yourFormName.txtFWareHouse

Then make sure that the form and subform are not linked via a master/child relationship.
Finally, set the main forms Current event to look like:

Private Sub Form_Current


End Sub
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.

All Courses

From novice to tech pro — start learning today.