A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Struggling with Calculated Field on Form to Main Form/Table



 
 
Thread Tools Display Modes
  #1  
Old October 1st, 2009, 05:56 AM posted to microsoft.public.access.forms
LisaInAz
external usenet poster
 
Posts: 12
Default Struggling with Calculated Field on Form to Main Form/Table

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
  #2  
Old October 1st, 2009, 03:50 PM posted to microsoft.public.access.forms
Dorian
external usenet poster
 
Posts: 542
Default Struggling with Calculated Field on Form to Main Form/Table

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" wrote:

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

  #3  
Old October 1st, 2009, 08:01 PM posted to microsoft.public.access.forms
LisaInAz
external usenet poster
 
Posts: 12
Default Struggling with Calculated Field on Form to Main Form/Table

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" wrote:

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" wrote:

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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:24 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.