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 Replies
ADVERTISEMENT
Jan 30, 2006
I have a combo box that is based on another combo box (with a query). When i make a choice in combo1 i get the appropriate value on combo2 but when i change the combo1 value i don't get the changes on combo2.
For example i have combo1 with values value1,value2 and on combo2 i have for combo1 the values val1_1, val1_2 for value2 val2_1,val2_2.
I choose the value1 on combo1 and i get the val1_1, val1_2 on combo2. If i change the value on combo1 to value2 then i still get the val1_1, val1_2 on combo2.
Any suggestion how to solve this problem an get the correct dependent values?
Thank you in advance:)
View 4 Replies
View Related
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
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
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
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
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
Apr 16, 2008
So here is my problem i am semi access savy but i have having trouble with one thing. At work when we make a schedule there are 5 possibilites for how you want to mark your day. I have created a field using text as my parameters since my possibilities include both letters and numbers. At the end of each week I need to create a calcuation only utilizing the number which is 1 to add up the total shifts in the week.
I have tried some IIF statements with no luck. The 5 possiblities are 1, c,r,a,l. Each of the letters stand for something. When the scheduler runs the query he needs to see the letters or the number for each day. But i can't create a properly working calculated field for adding all of the 1's together only. The letters don't need to be added. Any ideas?
Also I have to run a sum for the total of each day at the bottom so I am running into the same problem there if there is any letters in the boxes. Going to a number field is not an option
thanks for the help
View 6 Replies
View Related
Feb 9, 2006
Hi all,
I have a form tha is based on a table and a subfrom on another.The two tables have a valid 1 to many relationship and all is well record viewing wise.
Now I have some financial data like the fee that was agreed upon on the main form on a text box .On the subform the user can enter the payments made on variou dates.
What I want is to be able to have a text box on the main form that will do the subtraction (fee - all the various payments) and display that on the main form.Is this possible cause I cant seem to be able to do it and if it is not, is there another way for this to be done.
Thank you very much for your time :)
View 1 Replies
View Related
Jul 12, 2005
Could someone please help me with a calculation expression? I want the calculation to be in an unbound text box on the main form ([Primary View])which should calculate the sum total all records shown in the subform that contain a calculated field in the subform ([CBR Data Subform]!Rentable). The subform is set up in the main form to show records that pertain to one record in the main form. Right now, I have the following shown in the textbox:
=([CBR Data Subform]!Rentable) and I get a result but its not what I need.
I have tried:
=Sum([CBR Data Subform]!Rentable), &
=DSum([CBR Data Subform]!Rentable)
and I get error messages.
What other expression can I use or how can I improve the expression?
Thanks,
View 9 Replies
View Related
Oct 8, 2005
Hello,
I've got a text box on my form header with a calculation in the control source that adds values from other text boxes on my form.
My problem is that since the calculation is in the control source of my text box I can not save the sum of the calculation to a field on the forms bound table.
Is there a way to move this calculation out of the control source and still have the calculation populate this text box with the sum of the calculation, so I can choice a field in which to save this calculations sum.
Calculation in the text box control source=
[Tot40yrcomp]+[Totfelt1536]+[Totfelt3036]+ there will be many more other text boxes added.
It was suggested to me to have a Variable hold the calculation, I’ve been trying to write a variable but nothing seems to be working, I’ve been trying to place this variable I made into the after update and before update of the text box Nothing works I get all 0.00 in the form header text box, Here’s the code for the variable I made, can some one see if it looks correct.
Dim calcVariable
calcVariable = [Tot25yrcomp] + [Me.feltstot]
mat25yr = calcVariable
I was wondering if I need to say Me.mat25yr = calcVariable
Thanks--Any help will be greatly appreciated.
View 1 Replies
View Related
Oct 8, 2005
Hello,
I've got a text box on my form header with a calculation in the control source that adds values from other text boxes on my form.
My problem is that since the calculation is in the control source of my text box I can not save the sum of the calculation to a field on the forms bound table.
Is there a way to move this calculation out of the control source and still have the calculation populate this text box with the sum of the calculation, so I can choice a field in which to save this calculations sum.
Calculation in the text box control source=
[Tot40yrcomp]+[Totfelt1536]+[Totfelt3036]+ there will be many more other text boxes added.
It was suggested to me to have a Variable hold the calculation, I’ve been trying to write a variable but nothing seems to be working, I’ve been trying to place this variable I made into the after update and before update of the text box Nothing works I get all 0.00 in the form header text box, Here’s the code for the variable I made, can some one see if it looks correct.
Dim calcVariable
calcVariable = [Tot25yrcomp] + [Me.feltstot]
mat25yr = calcVariable
I was wondering if I need to say Me.mat25yr = calcVariable
Thanks--Any help will be greatly appreciated.
View 1 Replies
View Related
Nov 12, 2014
Got a database that is working great
1 table - Employees
2 Queries
1) - QEmployees Extended
2) - QyrsEmp
2 Forms
1) - Employee Details (source control is "QEmployees Extended")
2) - Employee List (source control is "QEmployees Extended")
in Form "Employee Details" there is field named "HireDate" this field is also found in the table (records) "Employees" and "QEmployees Extended".When Form "Employee Details" is ran the "HireDate" appears as it should in the "HireDate" text box.
What I want to do is add a unbound text box to Form "Employee Details" named "txtYrsEmp" (Years Employed). and perform a calculation that will take the "HireDate" (date) and compare it to "Todays Date" and come up with the number of years employed rounded by 2 and show this result in the unbound text box called "txtYrsEmp"
Now I did a Qurey just to see if I could calculate what I wanted- "QYrsEmp" where in the first column I entered in the Field row (top) Expr1: EmployeeID from table Employee and in the second column I entered in the Field row (top) txtYrsEmp: Round(DateDiff("d"'[HireDate],NOW()/365.25,2))
Now the query returns the exact results I want so I know the calculation is possible at least here in the query.
View 7 Replies
View Related
Jul 25, 2013
I am running in to a brick wall with this. I have an unbound text box with the control source set to =IIF([text42]=0,0,[text42]/[text44])*100 and in continues to return a #name? error.
I am not sure how to get this expression to work. I have even tried to put =[text42]/[text44] and I still get the #name? error.
View 3 Replies
View Related
Oct 7, 2005
Hello,
I've got a text box on my form header with a calculation in the control source that adds values from other text boxes on my form.
My problem is that since the calculation is in the control source of my text box I can not save the sum of the calculation to a field on the forms bound table.
Is there a way to move this calculation out of the control source and still have the calculation populate this text box with the sum of the calculation, so I can choice a field in which to save this calculations sum.
Calculation in the text box control source=
[Tot40yrcomp]+[Totfelt1536]+[Totfelt3036]+ there will be many more other text boxes added.
Thanks--Any help will be greatly appreciated.
View 1 Replies
View Related
Dec 4, 2013
So i have made a query which filters the text you type in your text box on a form. This is working great, but then this morning I had some records that contain some blank fields. My query does not show those records even if they contain the same text that I would type in my search form.This is my expression in my query of one column:
Like [Forms]![searchform]![Qprojectomschrijving] & "*"
View 7 Replies
View Related
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 3 Replies
View Related
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
May 16, 2005
Hello, I have the following criteria for my Query >=0.8*[Projects]![EstimatedHours]. This tells me when we've used 80% of our actual hours. How would I go about the criteria line if I wanted it to return above >= 50% hour use, but below 80%? Thanks
View 1 Replies
View Related
Sep 8, 2005
I have a query that is built up of 5 fields with only the 2 below being visible. I am wanting to be able to calculate the total price for each pole no i.e. Pole no 01-02 total price would be £1441.79, What is the best way to do this? Sample data is shown below
New Pole NoTotal Cost
01-02.....£437.08
01-02.....£476.37
01-02.....£36.21
01-02.....£70.27
01-02.....£51.56
01-02.....£370.30
01-1.....£437.08
01-1.....£476.37
01-1.....£36.21
01-10367.....£493.43
01-10367.....£70.15
01-10367.....£76.51
01-10367.....£102.67
01-10367.....£87.54
01-10367.....£36.21
01-10367.....£51.56
01-10367.....£39.54
01-11448.....£437.08
01-11448.....£463.25
01-11448.....£493.43
01-11448.....£476.37
01-11448.....£70.15
01-11448.....£76.51
View 4 Replies
View Related
Dec 6, 2005
In qryAddticket, I am trying to calculate two conditions (see Condition 1 & 2)However, I am having a problem on the first condition because it is adding 8 hours when it shouldn't. Can someone help to either fix my code or write a new one?
Condition 1: If the day_of_wk is 1, calculate time-reg_time/60, If the day_of_wk is 1 and time is less than 0, calculate time-reg_time/60+24
Condition 2: If the day_of_wk is 2, calculate time/60, If the day_of_wk is 2 and time is less than 0, calculate time/60+24
My code: pre: IIf([day_of_wk]="2",[time]/60,IIf([time]<0,([time]-[reg_time])/60+24,([time]-[reg_time])/60))
Thank you very much!
View 2 Replies
View Related
Feb 26, 2007
I need to calculate the total cost of the order and enter this into the "CostOfOrder" field which you can see in the picture...
http://i13.photobucket.com/albums/a298/steve01/untitled2.jpg
I need to read all the orderlines for an order into a record set and calculate the cost for each orderline. I need to use a loop in VBA to add them all together.
Here is the query for inclusion in VBA...
Dim StrSQL As String
StrSQL = "SELECT orderline.qty*sandwich.price"
StrSQL = StrSQL + "FROM sandwich INNER JOIN orderline ON
sandwich.sno=orderline.sno"
StrSQL = StrSQL + "WHERE (((orderline.orderno)="
StrSQL = StrSQL & orderno
StrSQL = StrSQL + "));"
Do Until recordSetData.EOF
Total = Total + recordSetData.Fields(0).Value
recordSetData.MoveNext
Loop
I think the Query is correct, but where do I put this in the form (or where do I actually put it as I don't know!) to make it work?
Thanks in advance!
Steve :)
View 1 Replies
View Related
Oct 19, 2004
Im building a database for a car dealership. what do i need to do to take how many times someones name comes up in a certain field in a table and show it as a number. I need to include this calculation in a subfrom on a form which displays "employee info" which is already stored. Basically i just need to take how many times there name shows in the salesman field and show it as a number.
thanks
please respond, URGENT!
View 2 Replies
View Related
Aug 19, 2007
Hi There,
I am trying to get a query to pull dates from a form to use as limiting parameters for a report. One of my forms has the user enter a range of dates into two text boxes (a from-date in one box and a to-date in another) as the range of dates they want to pull information from a table via the query. These dates are also used in the Title header of the report that is generated from the query information.
How can I get the query to use these dates in the text boxes, rather than having to use the "between / and" command on the criteria line of the query design?
If I just have parameter windows pop up and have the user enter the dates there, I can't use those dates for the report, or can I? Any help would be appreciated. Maybe I haven't explained this properly, if so, I'll try again if I've just confused you.
View 3 Replies
View Related
Jan 1, 2013
How do I concatenate a row in a query and put in a text box in a form? I have a Query returning up to 10 dates the row is called [Date] I need to put them all together with a space and a comma between them and place that in a text box on a form.
View 2 Replies
View Related
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