Me! Statements 
Author Message
 Me! Statements

I am having troubles with trying to save a calculated field.  I have tried
the Me! Statements in the AfterUpdate, but apparently I'm not doing
something right.

What I have is a form which has a subform and another (nested) subform.
When I pull up that form, I need to have the field "AVG" immediately and
automatically calculate this formula and save the result with that record.
THIS IS NECESSARY due to the fact that variables change frequently and we
need to store the EXACT variables which were used with that record.

My formula works correctly but when I try to include it in the AfterUpdate
OR BeforeUpdate as an event, it shows no results - all blanks.

Could someone PLEASE explain (IN PLAIN ENGLISH) how to properly set this
up - and please include specifics such as WHICH AfterUpdate event (Form or
control).

Thanx for keeping it simple!

t



Mon, 24 Dec 2001 03:00:00 GMT  
 Me! Statements
Tammie, i do not have enough info to provide a specific solution, however
there are some general things to look for:
1.you must have a control, say txtAvg, on a form to contain the result of
the calculation. this control should be bound to a field in a table using
the control's ControlSource property.
2.the 'calcs' themselves could be done several ways: if you want to display
the results dynamically, place calc in the AfterUpdate event of each control
whose value is used in the calc; if you just want to do calc as record is
saved, put calc in the BeforeUpdate of the form/subform containing ctlAvg
3.most common problem folks have with this is probably the references to
controls located on forms and subforms. if for example ctlAvg is on the main
form, and your calcs are in the BeforeUpdate event of the main form, the the
calc may look something like this:
me!ctlAvg=me![name of control containing subformA].FORM![name of control on
subformA]  + whatever

you should also lookup the Parent keyword in Help for other examples of
references when code is executin within a subform
--
make a nice day,
TomG
Tampa, FL


Quote:
> I am having troubles with trying to save a calculated field.  I have tried
> the Me! Statements in the AfterUpdate, but apparently I'm not doing
> something right.

> What I have is a form which has a subform and another (nested) subform.
> When I pull up that form, I need to have the field "AVG" immediately and
> automatically calculate this formula and save the result with that record.
> THIS IS NECESSARY due to the fact that variables change frequently and we
> need to store the EXACT variables which were used with that record.

> My formula works correctly but when I try to include it in the AfterUpdate
> OR BeforeUpdate as an event, it shows no results - all blanks.

> Could someone PLEASE explain (IN PLAIN ENGLISH) how to properly set this
> up - and please include specifics such as WHICH AfterUpdate event (Form or
> control).

> Thanx for keeping it simple!

> t



Tue, 25 Dec 2001 03:00:00 GMT  
 Me! Statements
In addition to Tom's (helpful) posts.... not multiposting your questions
(separately posting to multiple newsgroups) is a very helpful thing. Many
regulars (myself included) as a general policy will not answer multi-posted
questions. Targeting your questions is a better answer and much less
spam-like than the post everywhere thing.

Just a thought for you to consider.

--
MichKa

-------------------------------------
don't send questions by e-mail
unless you're paying for it. :-)

random junk of dubious value is at:
http://www.trigeminal.com


Quote:
> Tammie, i do not have enough info to provide a specific solution, however
> there are some general things to look for:
> 1.you must have a control, say txtAvg, on a form to contain the result of
> the calculation. this control should be bound to a field in a table using
> the control's ControlSource property.
> 2.the 'calcs' themselves could be done several ways: if you want to
display
> the results dynamically, place calc in the AfterUpdate event of each
control
> whose value is used in the calc; if you just want to do calc as record is
> saved, put calc in the BeforeUpdate of the form/subform containing ctlAvg
> 3.most common problem folks have with this is probably the references to
> controls located on forms and subforms. if for example ctlAvg is on the
main
> form, and your calcs are in the BeforeUpdate event of the main form, the
the
> calc may look something like this:
> me!ctlAvg=me![name of control containing subformA].FORM![name of control
on
> subformA]  + whatever

> you should also lookup the Parent keyword in Help for other examples of
> references when code is executin within a subform
> --
> make a nice day,
> TomG
> Tampa, FL



> > I am having troubles with trying to save a calculated field.  I have
tried
> > the Me! Statements in the AfterUpdate, but apparently I'm not doing
> > something right.

> > What I have is a form which has a subform and another (nested) subform.
> > When I pull up that form, I need to have the field "AVG" immediately and
> > automatically calculate this formula and save the result with that
record.
> > THIS IS NECESSARY due to the fact that variables change frequently and
we
> > need to store the EXACT variables which were used with that record.

> > My formula works correctly but when I try to include it in the
AfterUpdate
> > OR BeforeUpdate as an event, it shows no results - all blanks.

> > Could someone PLEASE explain (IN PLAIN ENGLISH) how to properly set this
> > up - and please include specifics such as WHICH AfterUpdate event (Form
or
> > control).

> > Thanx for keeping it simple!

> > t



Tue, 25 Dec 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Expected:line number or label or statement or end of statement

2. running sql code record by record instead of statement by statement

3. With...End With statement bombing out in For...Next statement

4. Very simple - How to execute sub statements before the end statement

5. Combine a Loop Statement and If Statement?

6. Update statement creates Error, when statement is fine

7. db.execute <sql statement> vs docmd..runsql <sql statement>

8. how to get through a Sql Statement data from a MDB with a date field as "where" statement

9. Can you help convert IF Statement to a Select Case Statement?

10. HELP!!! Doing multiple statements on IF THEN Statements??

11. IF statement and tables in VBA

12. DoCmd and Update statement

 

 
Powered by phpBB® Forum Software