saving forms to a table

  • Thread starter Thread starter vincentivy1
  • Start date Start date
V

vincentivy1

I have created a repair form using the wizard. The form was based on a
table also called repairs.
When I click the save button on my form, the fields with formulas for
doing calculations aren't saved to the table. Is there a way to make
access save those fields to the table?

Thanks

Vincent
 
Vincent

I'm not sure I understand...

You have fields in a table.

You add those fields to a form, so you can display them.

You add other fields to the form, not connected to any table, so you can
show calculated values.

You wonder why the calculated values are not being saved to the table ...
why would they be? There's no place for them.

Also, it is only rarely necessary to store calculated values, and doing so
creates a whole new series of potential issues/problems you would have to
add code to manage.

For example, say someone made a mistake entering one of the "raw" data
values, then goes back to correct/fix the mistake. How is the stored
calculated value supposed to get updated?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Vincent

I'm not sure I understand...

You have fields in a table.

You add those fields to a form, so you can display them.

You add other fields to the form, not connected to any table, so you can
show calculated values.

You wonder why the calculated values are not being saved to the table ...
why would they be?  There's no place for them.

Also, it is only rarely necessary to store calculated values, and doing so
creates a whole new series of potential issues/problems you would have to
add code to manage.

For example, say someone made a mistake entering one of the "raw" data
values, then goes back to correct/fix the mistake.  How is the stored
calculated value supposed to get updated?

Regards

Jeff Boyce
Microsoft Office/Access MVP






- Show quoted text -
My apologies for the lack of clarity in my post,

I created a form (using the form creation wizard), that contains all
of the fields from my "repairs" table. I amended a few of the fields
in the form to perform a calculation of Date Diff by putting the
formula in the control source of the properties for those fields. Now
when I click the save button on the form, it populates the table with
all of my entries. The execption is that my calculations don't transer
to the table. The calculated fields show up in the table as zeros. I
know it is because I changed the control source for those particular
fields. I guess what I want to know is there a way to have my form do
the calculation and populate the table when saved? Or if there is a
better way I am open to suggestions.

Thanks

Vincent
 
It only appears that 0's are being written. If your form's controls are not
bound to an underlying field, they are NOT being saved to the table. In
that instance, I'm guessing the table definition includes a default value of
0 for those fields in which you are seeing zeros.

Note again from my earlier response ... it is RARELY a good idea to save
calculated values. If you'll describe a bit more about your situation/your
data, the folks who volunteer their time here in the newsgroups may be able
to understand enough to tell you that your situation is one of those rare
times when saving calculated values makes sense ... or not!

Good luck

Regards

Jeff Boyce
Microsoft Office/Access MVP


Vincent

I'm not sure I understand...

You have fields in a table.

You add those fields to a form, so you can display them.

You add other fields to the form, not connected to any table, so you can
show calculated values.

You wonder why the calculated values are not being saved to the table ...
why would they be? There's no place for them.

Also, it is only rarely necessary to store calculated values, and doing so
creates a whole new series of potential issues/problems you would have to
add code to manage.

For example, say someone made a mistake entering one of the "raw" data
values, then goes back to correct/fix the mistake. How is the stored
calculated value supposed to get updated?

Regards

Jeff Boyce
Microsoft Office/Access MVP






- Show quoted text -
My apologies for the lack of clarity in my post,

I created a form (using the form creation wizard), that contains all
of the fields from my "repairs" table. I amended a few of the fields
in the form to perform a calculation of Date Diff by putting the
formula in the control source of the properties for those fields. Now
when I click the save button on the form, it populates the table with
all of my entries. The execption is that my calculations don't transer
to the table. The calculated fields show up in the table as zeros. I
know it is because I changed the control source for those particular
fields. I guess what I want to know is there a way to have my form do
the calculation and populate the table when saved? Or if there is a
better way I am open to suggestions.

Thanks

Vincent
 
I guess what I want to know is there a way to have my form do
the calculation and populate the table when saved?

Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact.

Just redo the calculation whenever you need it, either as a
calculated field in a Query or just as you're now doing it -
in the control source of a Form or a Report textbox.

John W. Vinson [MVP]
 
It only appears that 0's are being written.  If your form's controls arenot
bound to an underlying field, they are NOT being saved to the table.  In
that instance, I'm guessing the table definition includes a default value of
0 for those fields in which you are seeing zeros.

Note again from my earlier response ... it is RARELY a good idea to save
calculated values.  If you'll describe a bit more about your situation/your
data, the folks who volunteer their time here in the newsgroups may be able
to understand enough to tell you that your situation is one of those rare
times when saving calculated values makes sense ... or not!

Good luck

Regards

Jeff Boyce
Microsoft Office/Access MVP













My apologies for the lack of clarity in my post,

I created a form (using the form creation wizard), that contains all
of the fields from my "repairs" table.  I amended a few of the fields
in the form to perform a calculation of Date Diff by putting the
formula in the control source of the properties for those fields.  Now
when I  click the save button on the form, it populates the table with
all of my entries. The execption is that my calculations don't transer
to the table. The calculated fields show up in the table as zeros.  I
know it is because I changed the control source for those particular
fields.  I guess what I want to know is there a way to have my form do
the calculation and populate the table when saved? Or if there is a
better way I am open to suggestions.

Thanks

Vincent- Hide quoted text -

- Show quoted text -
The reason for the calculation is to calculate the the number of days
it takes a part to be returned for repair. The fields in the form and
table are called ship date, received date. My calculated field in
both the form and table is called transit days. Transit days is the
difference between the ship date and received date. In my form, I
have locked the transit days field because I have it so that the
calculation in performed when the dates are entered into the other two
fields. I want the result of the calculation to be placed in the
table when I click the save button on the form. I seem to be getting
zeros in the transit days field of the table, but that field in the
form is populated correctly.

Thanks,
Vincent
 
Back
Top