Struggling with Calculated Field on Form to Main Form/Table

L

LisaInAz

Thank you in Advance for any Suggestions. Using Access 2000 Windows XP
I have read many articles (ie, Struggling with calculated field on form,
calculated field on form to table, etc) on storing calculated fields and why
not to.
I believe I have an exception.

My customers are supervisors and quality control staff who are accomplishing
file management reviews. A portion of the dBase is dedicated to comparing
two Dollar Amounts; one is calculated from a query. The other needs to be
determined and stored for later review.

The supervisor will use my form much like a calculator to determine
TotalDollarAmount; I have it working except I would like to store the
TotalDollarAmt back to the Main form and upon closing the form it will save
it to the table. Quality control will review the two amounts and determine
if there was an overpayment or underpayment.

I have a dedicated field on the Main Table and Main Form for the field I
need called fldActualpayment.

I have a MainTable which I would like to store fldActualpayment

I have a MainQuery for MainForm that would like to “display†from the table
fldAcutalpayment

The Third Form(not a subform) “frmCalculateActualPaymentAmt†is access from
the MainForm using a “button†that accomplishes the following calculation

Fields on form Control Name
fldfulldayrate (unbound) FullDay
fldnumberofactualdays (unbound) NumberFullDays
fldfulldaypayment (unbound) FullDayAmt

fldhalfdayrate(unbound) HalfDay
fldnumberofactualdays (unbound) NumberHalfDay
fldhalfdaypayment (unbound) HalfDayAmt

fldTotalDollarAmount = [FullDayAmt] + [HalfDayAmt] TotalDollarAmount

There is only need to store the TotalDollarAmount.
I have tried SetValue and I have read and tried to follow and other
suggestions http://allenbrowne.com/casu-14.html but I can not figure it out.

After Update property of the TotalDollarAmount Box
In the Event Procedure
Private Sub TotalDollarAmount_AfterUpdate()
Me.fldActualPayment = [FullDayAmt] + [HalfDayAmt]
End Sub

Thanks for any help
 
D

Dorian

From your post, I cannot really figure out what you are trying to do.
Why do you have unbound fields on your form?
If you want to store a calculated value (a bad idea), just set up a control
bound to the table column.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
L

LisaInAz

I thought in order for my customer to enter data, that isn't attached to a
table, the fields in the form need to be "unbound". I am trying to use it
like a calculator that prompts them for the data needed. I actually have 11
fields on my form and I see I didn’t identify them correctly in my early
post. I have a FullDay Section and a HalfDay Section
They are as follows:

Name of Fields on form Control Source
fldfulldayrate (unbound)
fldfulldaydiscount (unbound) <not static>
fldDAmt (unbound)
=IIf([fldfulldaydiscount]>0,[fldfulldayrate]-

[fldfulldaydiscount],[fldfulldayrate])
fldnumberofFulldays (unbound)
FullDayAmt
=IIf([fldnumberofFulldays]>0,[ fldDAmt]*
[fldnumberofFulldays],0)
fldhalfdayrate(unbound)
fldhalfdaydiscount (unbound) <not static>
fldHAmt = (unbound) =IIf([fldhalfdaydiscount]>0,[
fldhalfdayrate]-
[fldhalfdaydiscount],[
fldhalfdayrate])
fldnumberofHalfdays (unbound)
HalfDayAmt
=IIf([fldnumberofHalfdays]>0,[ fldDAmt]*

[fldnumberofHalfdays],0)]
TotalDollarAmount = [FullDayAmt] + [HalfDayAmt]

I can not recreate the TotalDollarAmount field that I want to store, from a
query, as I am not storing any of the data from the forms.

I want to bring the TotalDollarAmount field back from this form to my Main
Form. I am hoping I can get some help on this - I just can't seem to figure
it out.
I may not be going about this the correct way so any additional advice would
be helpful.
Thanks
Lisa





Dorian said:
From your post, I cannot really figure out what you are trying to do.
Why do you have unbound fields on your form?
If you want to store a calculated value (a bad idea), just set up a control
bound to the table column.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


LisaInAz said:
Thank you in Advance for any Suggestions. Using Access 2000 Windows XP
I have read many articles (ie, Struggling with calculated field on form,
calculated field on form to table, etc) on storing calculated fields and why
not to.
I believe I have an exception.

My customers are supervisors and quality control staff who are accomplishing
file management reviews. A portion of the dBase is dedicated to comparing
two Dollar Amounts; one is calculated from a query. The other needs to be
determined and stored for later review.

The supervisor will use my form much like a calculator to determine
TotalDollarAmount; I have it working except I would like to store the
TotalDollarAmt back to the Main form and upon closing the form it will save
it to the table. Quality control will review the two amounts and determine
if there was an overpayment or underpayment.

I have a dedicated field on the Main Table and Main Form for the field I
need called fldActualpayment.

I have a MainTable which I would like to store fldActualpayment

I have a MainQuery for MainForm that would like to “display†from the table
fldAcutalpayment

The Third Form(not a subform) “frmCalculateActualPaymentAmt†is access from
the MainForm using a “button†that accomplishes the following calculation

Fields on form Control Name
fldfulldayrate (unbound) FullDay
fldnumberofactualdays (unbound) NumberFullDays
fldfulldaypayment (unbound) FullDayAmt

fldhalfdayrate(unbound) HalfDay
fldnumberofactualdays (unbound) NumberHalfDay
fldhalfdaypayment (unbound) HalfDayAmt

fldTotalDollarAmount = [FullDayAmt] + [HalfDayAmt] TotalDollarAmount

There is only need to store the TotalDollarAmount.
I have tried SetValue and I have read and tried to follow and other
suggestions http://allenbrowne.com/casu-14.html but I can not figure it out.

After Update property of the TotalDollarAmount Box
In the Event Procedure
Private Sub TotalDollarAmount_AfterUpdate()
Me.fldActualPayment = [FullDayAmt] + [HalfDayAmt]
End Sub

Thanks for any help
 

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

Top