Binding controls during load event

  • Thread starter Thread starter ABM
  • Start date Start date
A

ABM

I am experimenting with binding controls using ADO during the load event.
When the form opens I keep getting the parameter query message box. I
believe this has something to do with the subform that is linked to the main
form. How do you get around this? Works ok as long as form doesn't have
subform.
 
If you are merely changing the RecordSource property of the form to a SQL
statement, you should be fine, provided fields don't just disappear or
change data type (which can cause Access to crash.)

However if you are setting the form's Recordset property (Access 2000 and
later only), that won't work for a subform that has anything in its
LinkMasterFields/LinkChildFields. That's because Access reloads the subform
records when anything changes in the LinkMasterFields (e.g. if you change
records in the main form.) When that happens, the Recordset is lost, so the
approach you are taking cannot work.
 
Yes I am setting the forms Recordset property. After reading your post got
me to thinking maybe I could remove the fields in the subforms
LinkMasterFields/LinkChildFields and then set the links with VBA after I bind
the controls. This appears to work and the query parameter message no longer
appears. If you know of any problems this may cause please let me know.
Thanks
 
Back
Top