Adele has attended:
Access Intermediate course
Access Advanced course
Access VBA course
Access forms/subforms
I've set up a form and subform...
In the form you enter employee name and date and then the subform populates timesheet information (i.e. job number, activity performed, hours spent).
1. If I open the form in "Add form" view, then a blank record is automatically added to the subform.
2. If I open the form in "Edit form" view, then:
(a) If there are no records to find, then the subform is populated with the first record in the table (which has now been edited incorrectly with the name/date entered in the form).
(b) If there are records to find, the subform is populated with those (correct) records plus the edited (incorrect) record.
How do I stop both of these 2 things happening?
RE: Access forms/subforms
Hi Adele
Thank you for your question
I am assuming that you have built the subform using the wizards. If this is so, then you might well be better using a variation of the technique we covered on the VBA course.
Create an SQL string based upon the required time sheet information.
You will have to create a series of variables, set their values equal to the values of controls on the main form. You will then have to embed them into an SQL string.
You can then set the control source of the subform to that string.
If the recordset is empty, then you could simply set a condition to hide the sub form.
Hope this is helpful, if it doesn't work please get
back in touch
Regards
Stephen