Entering a formula in a "control source" box

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

Guest

Hi there,
I have created a form for our theatre group for when people call in to order
tickets. It is working well EXCEPT when I try to look at it as a table -
then any cells that I have put formulas (events) in like "=[Adult]*[Adult #]"
it works in form view but does the result does not display on the table. Any
ideas?
Dan
 
shaer said:
Hi there,
I have created a form for our theatre group for when people call in
to order tickets. It is working well EXCEPT when I try to look at it
as a table - then any cells that I have put formulas (events) in like
"=[Adult]*[Adult #]" it works in form view but does the result does
not display on the table. Any ideas?
Dan

Are you talking about the datasheet view of the form or the actual TABLE
that the form is bound to? If the latter then you need to know that
expressions DO NOT and SHOULD NOT write to the table.

A control writes to the table when its ControlSource is exactly the name of
a field. The use of any sort of expression means that it is no longer bound
to a field in the table and is instead only going to *display* the results
of the expression.
 
Don't look at the table except for design/development purposes. It is best
to think of tables as storage containers. [Adult] (which is the price for
an adult ticket, I assume) and [Adult#] are two different entities, and
should therefore be stored in separate fields. Forms are for working with
data on the screen, and reports are for printing. Perform calculations as
needed on the fly rather than attempting to store calculated values.
Suggestion: use only alphanumeric characters and underscores in field
names. Things like # signs could end up causing problems in code and
expressions, as many symbols have their own meanings.
 
Hi there,
What you said makes sence to me but let me explain what I am trying to do.
right now if I do a report it shows all the info - how many tickets in each
catagory which shows etc. But anywhere that I have put in a formula to save
time for out volunteers the totals don't show up anywhere except on the form.
So if I want to print out a report with the info I need the fields are blank.
Dan
--
--
Thank you for your help.


Rick Brandt said:
shaer said:
Hi there,
I have created a form for our theatre group for when people call in
to order tickets. It is working well EXCEPT when I try to look at it
as a table - then any cells that I have put formulas (events) in like
"=[Adult]*[Adult #]" it works in form view but does the result does
not display on the table. Any ideas?
Dan

Are you talking about the datasheet view of the form or the actual TABLE
that the form is bound to? If the latter then you need to know that
expressions DO NOT and SHOULD NOT write to the table.

A control writes to the table when its ControlSource is exactly the name of
a field. The use of any sort of expression means that it is no longer bound
to a field in the table and is instead only going to *display* the results
of the expression.
 
Hi there,
What you said makes sence to me but let me explain what I am trying to do.
right now if I do a report it shows all the info - how many tickets in each
catagory which shows etc. But anywhere that I have put in a formula to save
time for out volunteers the totals don't show up anywhere except on the form.
So if I want to print out a report with the info I need the fields are blank.
Dan
--
Thank you for your help.


BruceM said:
Don't look at the table except for design/development purposes. It is best
to think of tables as storage containers. [Adult] (which is the price for
an adult ticket, I assume) and [Adult#] are two different entities, and
should therefore be stored in separate fields. Forms are for working with
data on the screen, and reports are for printing. Perform calculations as
needed on the fly rather than attempting to store calculated values.
Suggestion: use only alphanumeric characters and underscores in field
names. Things like # signs could end up causing problems in code and
expressions, as many symbols have their own meanings.

shaer said:
Hi there,
I have created a form for our theatre group for when people call in to
order
tickets. It is working well EXCEPT when I try to look at it as a table -
then any cells that I have put formulas (events) in like "=[Adult]*[Adult
#]"
it works in form view but does the result does not display on the table.
Any
ideas?
Dan
 
shaer said:
Hi there,
What you said makes sence to me but let me explain what I am trying
to do. right now if I do a report it shows all the info - how many
tickets in each catagory which shows etc. But anywhere that I have
put in a formula to save time for out volunteers the totals don't
show up anywhere except on the form. So if I want to print out a
report with the info I need the fields are blank. Dan

Then you put that same "formula" in a query and base your reports off of the
query.
 
It is not a good idea to store a value that can be calculated when you need
it -- and, if it can be calculated in a Calculated Control in the Form, why
can it not be calculated when you need it in the Report, either in a
Calculated Control in the Report, or a Calculated Field in the Query you use
as the Record Source for a Report.

If some data that is a factor in the calculation, like ticket price, may
have changed (but the change does not apply to previous sales) then you may
have a valid reason for storing the calculated value. One way to do that is
to have a separate control bound to the Field in the Table, with its Visible
property set to No, and code in the events of each Control that is a factor
in the Calculation to set the invisible bound Control to the value of the
Calculated Control.

Larry Linson
Microsoft Access MVP


shaer said:
Hi there,
What you said makes sence to me but let me explain what I am trying to do.
right now if I do a report it shows all the info - how many tickets in
each
catagory which shows etc. But anywhere that I have put in a formula to
save
time for out volunteers the totals don't show up anywhere except on the
form.
So if I want to print out a report with the info I need the fields are
blank.
Dan
--
Thank you for your help.


BruceM said:
Don't look at the table except for design/development purposes. It is
best
to think of tables as storage containers. [Adult] (which is the price
for
an adult ticket, I assume) and [Adult#] are two different entities, and
should therefore be stored in separate fields. Forms are for working
with
data on the screen, and reports are for printing. Perform calculations
as
needed on the fly rather than attempting to store calculated values.
Suggestion: use only alphanumeric characters and underscores in field
names. Things like # signs could end up causing problems in code and
expressions, as many symbols have their own meanings.

shaer said:
Hi there,
I have created a form for our theatre group for when people call in to
order
tickets. It is working well EXCEPT when I try to look at it as a
table -
then any cells that I have put formulas (events) in like
"=[Adult]*[Adult
#]"
it works in form view but does the result does not display on the
table.
Any
ideas?
Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top