Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

access formssubforms

Forum home » Delegate support and help forum » Microsoft Access Training and help » Access forms/subforms

Access forms/subforms

ResolvedVersion 2003

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

Mon 19 Oct 2009: Automatically marked as resolved.

Access tip:

Display current date & time in column of any width

The worksheet function =NOW() returns the current date & time. When entered into a column which is not wide enough to display the value NOW returns, the cell displays ###

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.