Need Help - Calculation In Form

Mar 7, 2007

Hi. I am new to this site, and fairly new to Access itself.

I am currently designing a database for work that allows people to store information about sites around Blackburn. There is one main form and 3 subforms inside of it.

On Subform Yield Assessment, I would like the database to calculate the DT_YIELD field by multiplying SITE_AREA_HA * DT_DENSITY.

The thing is, SITE_AREA_HA is not visible in Form View, and it is a dLookup field (gets its data from SITES_AREA_HA field in the Sites Details Subform). Also, the DT_DENSITY figure is determined from the combinations from the cascading combo boxes before it (DT_SOURCE_SUP, DT_LOC_TYPE, DT_SITE_AREA_HA and DT_TEMPLATE).

I have attempted to put the different formulas into the Caption Source as follows (without ""):
1. "=[SITE_AREA_HA]*[DT_DENSITY]" <-- didn't work
2. "=[FRM_YIELD].[SITE_AREA_HA]*[FRM_YIELD].[DT_DENSITY]" <-- didn't work, came with the #Name? error in the field
3. "=[SUBFRM_YIELD].[SITE_AREA_HA]*[SUBFRM_YIELD].[DT_DENSITY]" <-- same error as 2
4. "=[SUBFRM_PRIMARY].[SITE_AREA_HA]*[SUBFRM_YIELD].[DT_DENSITY]" <-- same error as 2
5. "=[FRM_PRIMARY].[SITE_AREA_HA]*[SUBFRM_YIELD].[DT_DENSITY]" <-- same error as 2.... etc etc

I have even tried making a command button, with the following code, but it still doesn't work - and this comes up with "Compile Error: Argument not optional":

"Private Sub CAL_YIELD_Click()
Dim fMultiply As Integer

If SITE_AREA_HA > 0 And DT_DENSITY > 0 Then

fMultiply = SITE_AREA_HA * DT_DENSITY

DT_YIELD = fMultiply
Else

End If
End Sub"

Please help, it is driving me nuts, I just can't seem to make it work, yet it seems so simple. Again, I am fairly new at this. The database is attached - form to open is FRM_PRIMARY.

Thanks.

View Replies


ADVERTISEMENT

Calculation On A Form

Jan 25, 2006

I'm trying to figue out a way to make my database catagorize based on 2 variables, here's what i've got.

one variable is age, [age] and is entered directly into the form
the other is score, [pft total] and is a calculation performed with afterupdate functions.

what i would like to do is based on 4 age ranges and 3 score ranges (for each age) place the proper catagory (1st class, 2nd class, 3rd class) on the form.

for example a 27-36 yr old with a score of 200-300 is 1st class, but a 17-26 year old with a score of 225-300 is 1st class.

hope that's not to muddled

Jim

View 6 Replies View Related

Table/form Calculation

Sep 30, 2007

Is it posible to perform calculations within a table or data entry form. I have a date of birth field and an age field. I have an Update Action Query that automatically works out the date, (See below). However if I design the form with a close form event that triggers the query I get the confirmation message. I can only supress all Action queries confirmation messages or none at all and I do not want to disable this. Therefore I would like the age to be calculated within the table, (or form if that was possible). However I do not know how to do it.

DateDiff("yyyy",[DateofBirth],Now())+Int(Format(Now(),"mmdd")<Format([DateofBirth],"mmdd"))

View 2 Replies View Related

Query With Sub Form Calculation

Apr 3, 2008

In my Employees Sub form I have a calculation called Gross, the
calculation works fine but I can not get the query to gather the amount

View 1 Replies View Related

Error With Form Calculation

Apr 21, 2005

Hi!

I've encountered another stumbling block. My form is almost done except for some minor details. However, one calculation does not work even when I use the correct terms.

This calculates the tuition balance per customer based on data from 2 subforms on the main form: sbfTuitionAccount and sbfTuitionPayment.

My formula is =Nz(sbfTuitionAccount.Form![txttotaltuitionpayable])-Nz(sbfTuitionPayment.Form![txttotaltuitionpaymenttotal])

I've counterchecked all form and control names, however, when I test it, I only get a '#Error ' in form view. A similar formula has proven functional in another form. Do you have any ideas as to what the problem is?

Thanks!

View 1 Replies View Related

Calculation In A Query/Form

Sep 23, 2005

On my form I have a number of boxes that contain the results of a query. The query itself contains calculations that total items from a number of other forms. Going back to the form, their is a final box that then holds another total. this time it is the result of all the boxes totaled topgether. My problem is that if one of the queryshas no data i.e there is no information on that form then no total result is produced. Ive tried putting a default setting of 0, but that dosen't seem to work. Basically I'm trying to say that if any of the criteria contains no values then it should be 0. Does this make sense?

View 9 Replies View Related

Calculation On Form Footer Help

Jul 22, 2004

i have a subform that has a field that has this (=Round([TotalHoursPoss]*[PercentField])*0.27) in the control source. the form is set to Continuous Forms. it then have a field in the form footer that i need a total of what ever numbers show up in the field from above. for example.

field=41
field=41
field=32

form footer:

total=114

but every time i try to put this "=sum([BudgetedNumberofSales])" in the field in the form footer it gives me an error.

any ideas of what i am doing wrong.

thanks
chad

View 7 Replies View Related

Global Field For Calculation In A Form

Aug 22, 2005

OK, I figured out how to make a calculation. My big problem now is to have a global field, which would be "beginning balance" and "ending balance". I have 5 employees that share the budget. The budget starts at $1280.00. One employee may buy somthing one day and then another day while another employee may also buy something. I want to be able to put in the amount the employee spent and have it deduct from the balance. But then when I go to another employee and subtract what they spend I want that to subtract from the balance. I want the balance to be visible at all times no matter what employee I am on. Hope this makes sense. I have an attached file that shows how I did it for one employee. Cannot figure how to be able to do it for each employee and just the balance changes. Also I built a subform to be able to show different dates. But the problem again is having it subtract from one global balance. Thank you.

View 3 Replies View Related

Form Footer Calculation Error

Sep 6, 2005

I have a simple tabular form with the following:

cboItem_Name
txtItem_Cost
txtQuantity
txtExtended_Price

The AfterUpdate for txtQuantity = Me!txtExtended_Price = Me!txtItem_Cost*Me!txtQuantity, which puts the extended price in the control.

In the FOOTER of the form, I have txtSub_Total. It's Control Source is:
=SUM([txtExtended_Price]).

As far as I can tell from reading, when placed in the form footer and used in 'continuous form' layout, this ought to give me the total cost of ordered items.

Instead, I am getting #error. Can anyone help me with this?

View 13 Replies View Related

Working Days Calculation On Form

Jun 27, 2006

Anyone help please ? I'm still fairly new to ACCESS so forgive me if I'm completely on the wrong track !

I wish to add a control button to a form that will prompt me to enter a date and then calculate and display a date nn (fixed) number of WORKING days in the future.

I've seen some functions suggested in the forum and as I'm unfamiliar with this topic, I have tried putting together some code (see below) related to an On Click event for the button. I'm having syntax problems and have been battling away at this for some time without success.

Suggestions please !

Steve



Private Sub cmdDate_Click()
Dim FirstDate As Date ' Declare variables.
Dim Number As Integer
Dim dtEndDay As Date
Dim dtinterimday As Date
Dim intcount As Integer
Dim lnginterimdate As Long
Dim intdays As Integer

Dim Msg
FirstDate = InputBox("Enter a date - dd/mm/yy")
Number = 20

dtinterimday = FirstDate
intdays = Number
Do Until intcount = Abs(intdays)

If intdays &gt; 0 Then dtinterimday = dtinterimday + 1 Else dtinterimday = dtinterimday - 1

lnginterimdate = dtinterimday

If WeekDay(dtinterimday, 2) &lt;&gt; 6 And WeekDay(dtinterimday, 2) &lt;&gt; 7 Then

intcount = intcount + 1
End If
End If

Loop


Msg = "New date: " & dtinterimday
MsgBox Msg
End Sub

View 5 Replies View Related

Date Calculation On Form In Days

Aug 18, 2006

Hi
I have 3 date fields. I am trying to work out number of days when

=[FIELD1 - FIELD2 OR FIELD3]

should do the calculation in field 4 NUMBER OF DAYS. but it comes up with date only. FIELD1 will always be filled, if field 2 is field then the number of days must be based on that. but if field2 is blank then it should be field1 - field 3. I may need a help on the formula does it need any if, else statement or not. If so can someone please help

View 1 Replies View Related

Forms :: Form Combo Box Calculation

May 30, 2013

I have a combo box on a form that is liked to a table (current). That table has a list of available items and a count at the end of it. For example, apples, bananas, strawberries, blueberries, 4. Is it possible to have the combo box on the form subtract 1 from the count when an item is selected from the list? So when apple is selected the count of 4 is changed to 3.

View 4 Replies View Related

Forms :: Cannot Get Calculation To Display On A Form

Nov 12, 2014

I have a field called PriceSoldFor and I need to calculate and display this field multiplied by 3.4%. This is what I have tried and reading elsewhere it should work.In the Control Source of an unbound TextBox I have entered the following:

=[PriceSoldFor]*[.034]

But when I view the form the field displays the following:

#Name?

View 2 Replies View Related

Query Calculation Depedent On Form Text Box

Mar 6, 2008

I have a make table query which needs to take the column "Amount Orig Ccy" from the table "Consolidated Reporting Table Orig CCY", divide it by the Canadian Spot rate input by the user into text box "Spot" on the form "Summary Form", and then populate the column "Amount USD" with the returns.

Should I be using the DLookup function? I tried the below without success:

Amount USD: DLookUp("Amount Orig Ccy","Consolidated Reporting Table Orig CCY"/[Forms]![Summary Forms]![Spot])

Then I tried this, again failing:

Amount USD: DLookUp("Amount Orig Ccy / Spot Rate","Consolidated Reporting Table Orig CCY","Spot Rate =" & [Forms]![Summary Forms]![Spot])

Is it a syntax issue or will DLookUp not work for what I need?

Thanks for any help.

View 3 Replies View Related

Modules & VBA :: Use Parent Form Value In Subform Calculation

Nov 19, 2014

I have a parent form where I enter a value for tax rate. I need to use this value in the tax calculation in the subform fields i.e. subform.taxdue = subform.qty * subform.price * parent.taxrate.

I can get the value into the field. But I do not think I am putting it in the correct event. The parent form is a sales form and the subform is the sales items form. So there can be multiple items on the sub form.

View 5 Replies View Related

Forms :: Displaying Result Of A Calculation In A Form

Jun 17, 2015

I am creating a driving school database and have four different tables. Student, Instructor, Lesson and Lesson Type.

In the footer of my subform which works out what lesson type the student has taken and from which instructor, I have created a calculation to multiply the number of hours a student does to what type of lesson they take.

=([LengthOfLesson]*[cost]) (This works ok)

I then want to add all of these options together. I have tried:

=sum([OverallTotal]) in the footer (This doesn't seem to work)

and then

=[Booking].[Form]![OverallTotal] to show it in the form

The name of the subform is correct (booking) and name OverallTotal is also correct but I keep getting #error message.

View 3 Replies View Related

Forms :: Form Load Calculation Not Working

May 12, 2015

I have a bound form to an invoices table. The form details all invoices raised, all payments made and an outstanding balance. The outstanding balance control is just a basic text box.

On form load, I go to the payment table and select all payments into a recordset, I then add up all payments and use the following calculation:-

Balance = InvTotal - paytotal

The Invtotal is the control on the form that has it's control source set as sum(invoicetotal)

The calculation used to work and the correct balance was displayed, indeed, for one particular client, the calculation works, but for all others, the summed value is blank and so the balance is effectively set to the paytotal value.

I know this is to do with the timing as the form loads and it's records/data are made available, as I have an update button that does exactly the same things as the form load and when pressed, all numbers work.....primarily because the summed invoicetotal value is now available in the form control.

I can see what is happening, but not sure why...I thought that form load gave you all records and would have populated the summed control before triggering the load event....obviously not.....

View 9 Replies View Related

General :: Text Box Calculation - Main Form And Subform

Oct 23, 2012

is it possible to calculate a values in a subform and main form. i thought it would be as simple as form to form but it doesnt seem to work.

ive tried this.

=[Forms]![frmDeparturesPaymentScreen-ItemListSubform]![txtTotalCost]-[txTotalPaid]

it just comes up with #NAME?

View 7 Replies View Related

Queries :: Create A Query To Make Calculation From Form

May 16, 2013

I need to create a form that using combo boxes selects a product-size-quantity, and then calculates total price.I asume that I create a query to make the calculation from the form, but for the life of me, I can't fathom out how to do it.

View 3 Replies View Related

Forms :: Make Calculation For A Specific Row In Access Form

Jun 16, 2013

I'm pretty new to Access. I was wondering if it's possible to make a calculation for a specific row in an Access form.

I placed an example in the attachment (I made it quick in paint, because the actual Access form is in my language "Dutch" ):

Value1 and Value2 come from a database, so the amount of rows can change. When I click on "Calculate" on the first row, it should calculate 12 * 13 and show the solution only on row 1. If I click on "Calculate" on the second row, it should show the solution of 10 * 20 only on row 2.

I tried to solve this by using the following VBA code:

Private Sub Calculate_Click()
Solution.Value = Value1.Value * Value2.Value
End Sub

But if I click on the first "Calculate" button, it will fill all solutions with the first calculation (12 * 13).. The same happens when I click on "Calculate" on the second, third row etc.

View 2 Replies View Related

Modules & VBA :: Access 2010 / Form To Table Calculation?

Jun 7, 2013

In Access 2010 is it possible to have a tblKits with a column on it Reactions 8. Then on a form a field Used. When thee user inputs 2 into the Used field can the Reactions on in the tblKits be updated to 6 automatically?

View 1 Replies View Related

General :: Calculation On Form - Force 1 Decimal Place At All Times

May 7, 2014

I'm using a calculation on my form that subtracts one number from another and stores the difference between the two in a 3rd field. This works correctly but I want the difference to show 1 decimal place at all times.

So for instance if subtract 35.1 from 35.2 I get a difference of "0.1".

But if I subtract 35.0 from 36.0 I get a difference of "1".

The first case is fine but I need the difference to be "1.0" in the second case.

I've set the number of decimal places in the table from auto to 1 and changed the format on the form to a standard number with 1 decimal place. Neither of these show a difference of 1 as "1.0"

How to force 1 decimal place at all times?

View 3 Replies View Related

Adding Calculation Field (text Box) To Assets Template Form

Apr 3, 2013

I am trying to add a calculation field "Status" (text box) to Assets template form i.e

IF Asset item = X
Status = present

But am getting #name? in the text box

View 3 Replies View Related

IF Then Calculation

Oct 11, 2005

Trying to calculate a few fields. 1st field is [delays] and 2nd field is [Planned]
The Plan scheduled for 60 and the Delays are an entered value. In the on update command button on the form I want code that will take the value above 60 and add then to the value in the [Delays] So if delays is 10 and the planned is 70 then planned will change to 60 and delays will = 20

any help

Jon

View 2 Replies View Related

Q:Calculation

Oct 24, 2005

Hi All.

I have 3 tables in Access:
tblCurrency (Fields: IDCurrency, CDate, CRate)
tblOrder (Fields: IDOrder, OName, ODate)
tblCalculation (Fields: IDCal, Rate1, Rate2, Rate3, COrder)
IDOrder is related to COrder with "One to Many" connection.

I have Form frmOrder, based on tblOrder. For Example Form has 1 record:
IDCal OName ODate
1 XXXX 2005.10.24

For this record related table has 2 records:
IDCal Rate1 Rate2 Rate3 COrder
1 10 3.5 15 1
2 6 4.2 12 1

tblCurrency for Exapmle have one record too:
IDCurrency CDate CRate
1 2005.10.24 0.2

In frmOrder I have textBox txtRate. Here I need to be calculated:

=Sum (Rate1*(CRate from tblCurrency Where tblCurrency.Cdate = tblOrder.Odate)+Rate2*Rate3 for Each record related to tblOrder).
By Exapmle: (10*0.2+3.5*15)+(6*0.2+4.2*12)=106.1

Please help with expression.
Thank You in advance.

View 3 Replies View Related

Need Help With Calculation

Jun 9, 2007

hey i hope some one can help me...

I am making a database for products and suppliers. Many suppliers can supply each product.

The product details are in a table called products, the suppliers details are stored in a table called suppliers and the suppliers offer for each product is stored in a table called prices.

the structure is as follows:

Table: Products
Product Name
Trade Price

Table: Suppliers
Supplier Name

Table: Prices
Product Name
Supplier Name
Supplier Offer

I have form that shows the product details and a subtable linked to the table:prices.

The problem

I need to add a field in the subtable called "Percent off trade" which is the trade price - supplier price / trade price * 100

i created a query showing the same records as the prices table plus the field "trade off price" and set the Field to:

Percent Off Trade: ([Forms]![Products]![Trade Price]-[Prices]![Supplier Price])/[Products]![Trade Price]*100

But this doesnt give me the correct percent :confused:

I hope i have explained this query and would really appreciate anyone who takes the time to suggest anything that could help

thanks in advance!

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved