On May 17, 5:19 pm, "Sylvain Lafontaine"
Post by Sylvain LafontaineWhen 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.
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
"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)
Post by tomocbI'm trying to set the record source to a parameter based SP depending on
where the form is opened from.
However, I have a problem that the subforms are expecting their child
parameter values even when the subforms are disabled.
How should I work around this problem? Thanks.- Hide quoted text -
- Show quoted text -
Thanks for the reply Sylvain. Your post makes perfect sense.
However, I still don't understand why my form is still asking for a
parameter value when I open it and change the record source and the
input parameters also. E.g.
Default form properties:
Record source = spProductsResync
Unique Table = tblProducts
Resync Command = {Call spProductsResync(?)}
Input Parameters = @ProductID Int = 0
On Open form properties:
Record source = spProducts
Unique Table = tblProducts
Resync Command = {Call spProductsResync(?)}
Input Parameters =
As you will see from the example that I'm not supplying any parameters
on the On Open event. I'm also clearing the parameters before
changing the record source.
Also, my subform record sources require parameters that equal the
master record ID. It looks like I've sorted the problem of the
subform parameters but gained a problem with the master form one
instead!