Okay. You cannot change the order of execution of the Access events, but you
can usually work around them.
One option might be to save the form with nothing in the
LinkMasterFields/LinkChildFields properties, and assign them in the Open
event of the main form. This bypasses the problem at the time the subform is
being opened.
Another option might be to use the Open event of the main form to assign the
RowSource of each subform control. This bypasses the need to use some/all of
the LinkMasterFields/LinkChildFields properties.
I've never tried using the Error event of the subform to just ignore the
error and continue anyway: probably would not work.
Provided there was something on the main form (e.g. hidden text box) with
the same name as the field(s) in LinkMasterFields, the message should
disappear?
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Cathi said:
Allen, sorry (now I'll have to be lengthy, was trying to avoid that -) )
I have a form with 2 subforms, this form will hold the same data but from
different recordsets. So, to avoid making mulitiple forms that are exactly
the same I want to be able to set the recordsouce from the "onclick" event
of the switchboard.
What is occuring is that regardless of where I load the subforms from the
mainforms events I am getting a prompt for the masterfield link. However,
if I just click through the prompt box the subform loads and links
correctly. It seems to be a timing issue where the subform always loads
prior to the mainform, regardless, and can not find the linking fields until
everything is fully loaded.
I need to figure out how to stop that prompt box from appearing;
everything that I have tried fails to stop the prompt box from appearing. I
am on the verge of slopping design and making a form for each recordset -
arrgh.