When the record source of a form is changed, this form automatically
requeried; which means that all of its subforms must also be requeried in
order to keep them in sync.
I would see four possibilities to solve this problem:
1- remove the record source (set it to blank) of all subforms before
changing the record source of the main form and put it back after.
2- or do the same with the LinkMasterField and ChildMasterField: remove them
before and reput them after.
3- or use a constant sql string for the record sources of the subform using
the keyword EXEC to call the SP; for example:
"EXEC MySP parm1, parm2, 'parm3', ...."
As this is a constant string with no longer any parameters depending on
the record source of the main form, this should block the requerying of the
subform. However, with this method, you will have to reset the query string
each time the user navigate the main form in its OnCurrent event.
4- or make sure that the SPs have all the same list of parameters, even if
they don't need them.
--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Blog/web site:
http://coding-paparazzi.sylvainlafontaine.com
Independent consultant and remote programming for Access and SQL-Server
(French)
- Show quoted text -