access formssubforms

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

Access forms/subforms

resolvedResolved · High Priority · Version 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:

Deleting duplicate records from a table

You cannot delete records tables where there duplicate records. A way around this is to create a new table which wont hold the duplicates. and then deleting the old table.

1. Use a make-table query based on this table only. IMPORTANT - Ensure that you include all of the fields from your original table or you may loose data.

2. Open the query's property sheet by using VIEW, QUERY, PROPERTIES, and set the Unique Values property to Yes

3. Because you have selected the Unique Values to Yes when you run the query, Access creates a new table without duplicate records. You can now delete the old table and rename the new one.

View all Access hints and tips


Server loaded in 0.07 secs.