PC Review


Reply
Thread Tools Rate Thread

subform based on external SQL won't requery

 
 
clh
Guest
Posts: n/a
 
      14th May 2010
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.
 
Reply With Quote
 
 
 
 
Steve Sanford
Guest
Posts: n/a
 
      15th May 2010
Not sure it will help you, but do you know about the 'StillExecuting'
Property? Try help or Google 'StillExecuting' ..

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


"clh" wrote:

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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Requery subform Field based on another Subform Field's selection Shanty Microsoft Access Forms 0 10th Jan 2009 07:17 PM
Requery One Subform Based on Current Record in Another Subform =?Utf-8?B?SmVu?= Microsoft Access Form Coding 2 29th Mar 2007 06:18 PM
Requery subform combobox based on other subform selections =?Utf-8?B?QWRhbQ==?= Microsoft Access Form Coding 9 15th Jun 2006 05:52 AM
Requery subform combobox based on other subform selections =?Utf-8?B?QWRhbQ==?= Microsoft Access VBA Modules 1 14th Jun 2006 06:15 AM
Filter/requery a subform based on active record of another subform =?Utf-8?B?dGZvc3N1bQ==?= Microsoft Access Getting Started 1 10th Feb 2005 08:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:03 PM.