dbTalk Databases Forums  

How to execute a calculation instruction in a second form.

comp.databases.ms-access comp.databases.ms-access


Discuss How to execute a calculation instruction in a second form. in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Simon van Beek
 
Posts: n/a

Default How to execute a calculation instruction in a second form. - 08-28-2010 , 05:38 AM






Dear reader,

I work with two forms.

A field in the master form has an After Update event with the instruction
Me.Refresh.

If this event is activated the other fields in the form are refreshing
correct, so far so good.

But in case the same field from the same table is updated in a second form
and the After Update event in this second form have the same VBA
instructions as the main form with only the replacement of Me. with
Forms!MasterForm.

Then the following instruction will not be executed:

Forms!MasterForm_A.Fiel_A = (Forms!MasterForm_A.Fiel_B -
Forms!MasterForm_A.Field_C)

And in case I place a massage instruction before the calculation instruction
it works.

MsgBox "Now the calculation will be executed.", vbExclamation

It looks like the calculation instruction needs same pause before the
execution.

Is there anyone who knows way it dos not work without the massage
instruction before the calculation instruction.

Thanks for any help.

Kind regards,

Simon

Reply With Quote
  #2  
Old   
Bob Quintal
 
Posts: n/a

Default Re: How to execute a calculation instruction in a second form. - 08-28-2010 , 09:21 AM






"Simon van Beek" <SvanBeekNL (AT) hotmail (DOT) com> wrote in
news:4c79180e$0$2962$bf4948fe (AT) news (DOT) tele2.nl:

Quote:
Dear reader,

I work with two forms.

A field in the master form has an After Update event with the
instruction Me.Refresh.

If this event is activated the other fields in the form are
refreshing correct, so far so good.

But in case the same field from the same table is updated in a
second form and the After Update event in this second form have
the same VBA instructions as the main form with only the
replacement of Me. with Forms!MasterForm.

Then the following instruction will not be executed:

Forms!MasterForm_A.Fiel_A = (Forms!MasterForm_A.Fiel_B -
Forms!MasterForm_A.Field_C)

And in case I place a massage instruction before the calculation
instruction it works.

MsgBox "Now the calculation will be executed.", vbExclamation

It looks like the calculation instruction needs same pause before
the execution.

Is there anyone who knows way it dos not work without the massage
instruction before the calculation instruction.

Thanks for any help.

Kind regards,

Simon

The command is probably being executed, but using the old data on the
master form, not the newly updated data in the second form.The
messagebox causes sufficient time for the data to propagate through
to the master form.

From the second form, first make sure that the record is written to
the table with me.dirty = false, then also Forms!MasterForm_A.refresh
before and after updating your calculations


--
Bob Q.
PA is y I've altered my address.

Reply With Quote
  #3  
Old   
bobh
 
Posts: n/a

Default Re: How to execute a calculation instruction in a second form. - 09-01-2010 , 02:15 PM



On Aug 28, 6:38*am, "Simon van Beek" <SvanBee... (AT) hotmail (DOT) com> wrote:
Quote:
Dear reader,

I work with two forms.

A field in the master form has an After Update event with the instruction
Me.Refresh.

If this event is activated the other fields in the form are refreshing
correct, so far so good.

But in case the same field from the same table is updated in a second form
and the After Update event in this second form have the same VBA
instructions as the main form with only the replacement of Me. with
Forms!MasterForm.

Then the following instruction will not be executed:

Forms!MasterForm_A.Fiel_A = (Forms!MasterForm_A.Fiel_B -
Forms!MasterForm_A.Field_C)

And in case I place a massage instruction before the calculation instruction
it works.

MsgBox "Now the calculation will be executed.", vbExclamation

It looks like the calculation instruction needs same pause before the
execution.

Is there anyone who knows way it dos not work without the massage
instruction before the calculation instruction.

Thanks for any help.

Kind regards,

Simon
maybe try a "DoEvents" command in place of the msgbox.....
bobh.

Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.