Delay

jamesormi

Registered User.
Local time
Today, 20:54
Joined
Nov 19, 2008
Messages
20
Hi,

I'm experiencing problems when requerying a subform (Form_subform.Requery). I'm looking to get a total value from that subform to update on my main form. At times I'm getting 0 as the value as the requery has not complete.

Is it possible to add a delay to the code to wait until the requery is complete before moving on to the next line of code?

thanks in advance
 
try this and see if it works:

subYourSubFormHere.requery

'Delay code 1 sec
While Now() < DateAdd("S", 1, Now())

Wend

Ideally though, you need to pass the value to the main form, from the subform on completion of requery.
 
Is it possible to wait until the requery has been completed?
 
try this and see if it works:

subYourSubFormHere.requery

'Delay code 1 sec
While Now() < DateAdd("S", 1, Now())

Wend

Ideally though, you need to pass the value to the main form, from the subform on completion of requery.

Does that method work?

Reason I asked is that I tried an empty while/wend loop once as a delay (waiting for a condition to become true before proceeding) and it chewed up all the processor resources, preventing or severely delaying the background process I was trying to monitor.
 
Does that method work?

Reason I asked is that I tried an empty while/wend loop once as a delay (waiting for a condition to become true before proceeding) and it chewed up all the processor resources, preventing or severely delaying the background process I was trying to monitor.

To be honest Mike, I've never tried using this method. Thats why I said

try this and see if it works:

:)
 
James,

If its only the total that you want after the requery action, then build a text box in the form footer of the sub form. Make the control source of the Text Box =sum([TheFieldYouWishtoTotal]), and then in the field on your main form set the control source = [TheNameOfTheSubFormHere].[Form]![TheNameOfTheControlYouJustCreatedOnTheSubForm]. This will always update after the requery.
 
James,

'Delay code 1 sec
While Now() < DateAdd("S", 1, Now())

Wend

I thought I'd test to see if its works after Mikes comments, ignore the code its wrong. It should have been:

Code:
Dim dtmHoldDateTime as Date

'Delay code 1 sec
dtmHoldDateTime =DateAdd("S", 1, Now())

While Now() < dtmHoldDateTime

Wend

Tested it but as Mike says, it chewed up all the processor resources, preventing or severely delaying the background process.
 
James,

If its only the total that you want after the requery action, then build a text box in the form footer of the sub form. Make the control source of the Text Box =sum([TheFieldYouWishtoTotal]), and then in the field on your main form set the control source = [TheNameOfTheSubFormHere].[Form]![TheNameOfTheControlYouJustCreatedOnTheSubForm]. This will always update after the requery.
This is exactly what I was looking for.

Thanks
 
James,



I thought I'd test to see if its works after Mikes comments, ignore the code its wrong. It should have been:

Code:
Dim dtmHoldDateTime as Date

'Delay code 1 sec
dtmHoldDateTime =DateAdd("S", 1, Now())

While Now() < dtmHoldDateTime

Wend

Tested it but as Mike says, it chewed up all the processor resources, preventing or severely delaying the background process.
Actually, I think you can throw a DoEvents in the middle and it will help a bit, but the point is moot now...
 

Users who are viewing this thread

Back
Top Bottom