Subform shows actual record, no list of 3 last added records

janfolmer

Registered User.
Local time
Today, 09:30
Joined
Nov 30, 2005
Messages
24
Hi There,

I have got this form, consisting of 1 form (that needs to add a new record to a table everytime) and 1 subform, that needs to show the last three records of the table.

My problem is that I cannot get it right, now both forms (form and subform) are showing the details on just one record. If I open my subform it shows me all the records of a table, but in as soon as I view the form as a subform I shows me only one record.

Any help is welcome, I attached my db, just in case....
 

Attachments

But your main form and subform are both based on the same table. When your main form shows a record, then the subform also shows the same record.

You can't add new records in the mainform because it opens on the first record in the table and you have removed the navigation buttons so you can't get a new record.

Perhaps if you explained the business process you want to implement we might be able to help.
 
Hi Neil,
Thanks for your reply. The business process is as followed: I need to capture new employees in the table. For that I use that form. But I would like to see the 3 last added employees. So in that subform, I can quickly see the last three added records in the table, just for checking purposes....
 
So you need to base your subform on a query that returns the last three employees. Your main form needs to be set to Data Entry and you need the subform in the detail section and your data entry fields in the form header. See the attached.
 

Attachments

Perfect Neil, never thought of a query. Only when I add new employees, the query does not update automatically. Is there a way to update the query on adding one record in the main form?
 
You need to requery the subform. Add some code to the AfterUpdate event of the form like this:
Forms![frmForm]![tblEmployees].Form.Requery
 

Users who are viewing this thread

Back
Top Bottom