Subforms not updating properly

ca9mbu

New member
Local time
Today, 00:41
Joined
Feb 9, 2000
Messages
5
I have a tab control on my form. One page has contact details for a company, the other has assignment details. Each company can have more than one contact, and more than one assignment. I have put a subform on each page so as the one-to-many relationship can be shown. However it will only show the contacts/assignments for the first company added to the database, not for any of the others despite them all having contact/assignment details stored about them.

The subforms are linked to the master form by fldCompanyID from their respective tables.
If anyone could tell me how to go about fixing this I'd appreciate it.

Matt
 
Sounds to me like your relationships are fine but, if what is happening is that when you change records in the main form the subform records don't change then what you need to do is requery the subforms.

This is done by putting a line of code like this behind the OnCurrent event of the main form.

Me![ContactsSubFormName].Requery
Me![AssignmentsSubFormName].Requery

Be sure to get the subform name right - it is not the name of the form, it is the name of the control holding the subform, these are sometimes different.

You may need to refer to the above code in your AfterDelConfirm event also.

Hope that sorts your problem somewhat.

Ian
 
Check the master/child link properties. It sounds like they are not properly set. When they are set correctly, Access will keep the subform in sync with the master form.
 
I'd already got the requery line in the correct place, and I knew that the master/child link properties were correct as well, hence me posting here - I'd run out of ideas. After an hour of getting nowhere I created a new form with the two subforms on it and they worked fine, checked all the properties between the fixed and teh broken forms and they were all the same!

At least it's working now, thanx anyway.

Matt
 

Users who are viewing this thread

Back
Top Bottom