Binding controls during load event

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.
 
A

Allen Browne

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.
 
A

ABM

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top