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
On Dec 28, 7:24 pm, "Jeff Boyce" <nonse...@nonsense.com> wrote:
> Vincent
>
[quoted text clipped - 38 lines]
>
> - 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
vincentivy1@comcast.net - 29 Dec 2007 01:32 GMT
> 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
[quoted text clipped - 81 lines]
>
> - 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
> 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]