AccessForm RmPrice*Rms = Amount (doesn't calucate in Amt field)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm creating a Form w/ a combo box(RoomPrice) * (Text box) no of Rooms =
(Text box) Amount$$$. It should calculate new Amount on Form and post in
record

=Room1GAmt[Room1]*[Room1Qty] doesn't work expression builder

But =[Room1]*[Room1Qty] will display on form but not post to record

Help me . It needs post in record for future calculations....

Thanks WR (e-mail address removed)
 
you have the calculation occuring on the form; thus that text box is a
calculated value....and it can't do double duty in being both a form
calculated value and an input to a record on a table....

now the purists in DB theory say one should never record a calculated value
- by the way - afterall you have the price/room and quantiy in the
table.......so that calculated value is always available to you....but hey....

so what you might want to do is really is to do the calculation in the
table; you can put the calculate value in a field of the table....you might
have to add a 'calculate' button that will close your form and reopen it so
the textbox based on that value will then enter....

more than one way to skin this cat....
 
Further to this discussion, I have the feeling that what this user really
wants to achieve can be best done by doing the computation in a new query
associated to your table, creating a calculating field, and using that result
in your form, instead of doing this calc in the form itself.

This approach has the advantages of:

+ No calculations need to be stored, as "NetworkTrade" rightly points out.
+ You do not have to repeat this calculation all over your project
= very messy if you have to change it later.

You then simply associate your form to the query instead of to the table
itself,
and use their fields as if they were the table fields themselves. Voil'a!
no more calculations in forms or reports!

I even go to the extreme of creating a query for every table, even if I am
not doing anything special with its data. If I ever need a calc, I do it in
the query, and then can pull that as a field wherever needed. My forms and
reports contain almost no calc fields at all.

My belief is that, in general, it is a waste of time to do calculations
anywhere else other than in a query. Your code usually becomes a nightmare
to maintain later on unless all or most calculations are inside queries.

One BIG exception is that if the calculated value should not change no
matter what happens with your program. For instance, you already invoiced a
customer with a calculated amount somewhere. You do NOT want that value to
change afterwards (I would not). The rationale is, if prices change later
on, that total should not change. Of course, there are other considerations
to this situation as well, but will leave those for your homework.

LAMP90

NetworkTrade said:
you have the calculation occuring on the form; thus that text box is a
calculated value....and it can't do double duty in being both a form
calculated value and an input to a record on a table....

now the purists in DB theory say one should never record a calculated value
- by the way - afterall you have the price/room and quantiy in the
table.......so that calculated value is always available to you....but hey....

so what you might want to do is really is to do the calculation in the
table; you can put the calculate value in a field of the table....you might
have to add a 'calculate' button that will close your form and reopen it so
the textbox based on that value will then enter....

more than one way to skin this cat....
--
NTC


76 Group Man said:
I'm creating a Form w/ a combo box(RoomPrice) * (Text box) no of Rooms =
(Text box) Amount$$$. It should calculate new Amount on Form and post in
record

=Room1GAmt[Room1]*[Room1Qty] doesn't work expression builder

But =[Room1]*[Room1Qty] will display on form but not post to record

Help me . It needs post in record for future calculations....

Thanks WR (e-mail address removed)
 
Back
Top