subform based on external SQL won't requery


C

clh

I've got a main form with a subform. The subform data is based on a
non-updateable SQL query from an external data source.

To edit a record in the subform, I have an "Edit" command button that pulls
up the data from the selected record in the subform into a separate unbound
"edit" form.

When finished modifying the record, the user clicks a Save command button on
the "edit" form. The code in this Save command button issues a SQL Execute
command on an AODB.connection object to update the external data source with
the modifications, issues a Requery to the subform, then closes the "edit"
form.

The subform refuses to requery and show the updated data. I can see in the
table itself that the data was updated, and on the main form if I move to
another record and back to the original record on the main form, then the
subform will show the updated data.

This appears to be a timing thing between the issuing of the SQL Execute
command and the subform Requery. If put something in the code to just delay
5 seconds after issuing the SQL Execute and the subform Requery, the Requery
always works. If I delay 2 seconds, sometimes it works and sometimes it
doesn't. (I haven't tried in between to see exactly where the "always works"
threshhold is.)

So it appears that the Execute commands takes a bit of time to actually
perform the update of the data in the table but does not wait for that
process to finish before moving on and doing the Requery command on the
subform.

I didn't see one in the Help info for the Execute method on the
AODB.connection object, but is there something that tells it to wait to
finish processing before moving on to the next line of code?

Or anything else I can do between the Execute and Requery commands to ensure
that the Execute is finished before issuing the Requery? (I really don't
want just put a hard coded 5 second delay in there.)

Thank you.
 
Ad

Advertisements

S

Steve Sanford

Not sure it will help you, but do you know about the 'StillExecuting'
Property? Try help or Google 'StillExecuting' ..

HTH
 

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