Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Show last 5 records in subform in Access

Posted on 2010-08-26
2
Medium Priority
?
687 Views
Last Modified: 2012-05-10
I have 2 tables

Table 1: FWareHouse ( MainForm)
Fields:
FWarehouse

Table 2: FWHs Inbounds (Subform)
Fields:
FWarehouse
Fiscal Year
Week ID
Cases
Weight
XDock


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)
0
Comment
Question by:mercybthomas74
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
bgrandjean earned 2000 total points
ID: 33533189
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
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 33542583
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

    me.SubformControlName.Form.Requery

End Sub
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question