Forms :: Calculation Using Combobox Output
Jun 26, 2015What code can I use to multiply the quantity field by the cost field on a form, when the cost field is the output of a combobox.
View RepliesWhat code can I use to multiply the quantity field by the cost field on a form, when the cost field is the output of a combobox.
View RepliesI am trying to use a combobox called Manufacturer to select which table the combobox called Model gets it's rowsource from using the code below.
Code:
Private Sub Manufacturer_AfterUpdate()
If (Me.Manufacturer.Value = "Siemens") Then
Me.Model.RowSourceType = "Table/Query"
Me.Model.Recordset = "SeimensTable"
Me.Model.RowSource = "SELECT Model FROM SeimensTable"
Else
If (Me.Manufacturer.Value = "Samsung") Then
Me.Model.RowSourceType = "Table/Query"
Me.Model.Recordset = "SamsungTable"
Me.Model.RowSource = "SELECT Model FROM SamsungTable"
End If
End If
End Sub
But when I run the form and select Manufacturer. Combobox Model remains empty. tell me what I'm doing wrong?
I'm using Access 2007 SP3.
Whenever I export reports to PDF, the output appears zoomed and clipped. No extra pages are generated as they would be if I'm going over margins, it's just the report is clipped.
The report looks perfect in preview mode, and it looks perfect when going to an actual printer. However, when using OutputTo to save it as a PDF, this is when the report content is clipped.
Here is the code I'm using:
DoCmd.OpenReport MyReport, acViewPreview
DoCmd.OutputTo acOutputReport, "", acFormatPDF, "MyReport.pdf"
DoCmd.Close acReport, MyReport
I open the report in preview mode first so events are fired that show/hide various objects based on fields in the recordset.
I've tried reinstalling, and I've tried this on two different machines, one running Windows 7 and one running Windows Server 2008...both with the same results.
Basically what I want is to be able to display a total count of a particular product type into a single text box, so that I can have on the form :
You have [number] of product type in stock.
My SQL code works correctly but when I add it to the control source of the unbound text box I get "#Name?" instead.
The SQL statement is:
SELECT Peripherals.PerType, Sum(Peripherals.Quantity) AS SumOfQuantity
FROM Peripherals
GROUP BY Peripherals.PerType
HAVING (((Peripherals.PerType)="Mouse"))
ORDER BY Peripherals.PerType;
Is this the correct way to be putting a SQL statement in the control source ?
Using 2010.Would like to open a new form as a popup to display the results of a query. Trying to avoid eliminating objects in my DB, so not wanting to create Query Objects, but just creating the SQL on the fly.
The purpose of opening the popup form is to display the results of the Query based on a Button selection that the user chooses. Not sure if I can pass the Query from Form to Form, or if the called Form should run the Query. The Query output is a single record which is a Memo field, which is why I want to open the new form to display the result. The Memo text can be a page long or more.
I am not getting any errors and can open the form. The problem is that I am not getting the Query results displayed on the new form. The code below is from my first form that has the buttons. The popup form is Results_frm.
Code:
Private Sub InScope_bt_Click()
Set dbs = CurrentDb
strSQL = "SELECT In_Scope FROM Project_Scope_Deliverables"
Debug.Print strSQL
ResultType = "I"
DoCmd.OpenForm "Results_frm"
Forms!Results_frm.RecordSource = strSQL
End Sub
I guess you've all heard this one before, but I'm relatively new to Access, and was wondering if there was a way to export data from a form to an already existing Excel spreadsheet via a form button. Is this even possible in MS Office 2007, or even at all?
View 2 Replies View RelatedI am not even sure where to start with this small problem that will make a big difference.
I have a database that produces yearend accounts, its highly specialized to my industry.
The year end accounts have schedules these can be 1 to 3
On my form I have it set up for 3 schedules, but can be used for 1 and 2 schedules accounts.
However when it come to the reports for layout reasons 3 of the 14 reports needed are tailored to a 1, 2 or 3 schedule, and i have created reports and buttons on the form according to the number of schedules for that account.
What I want to know is this, I have a field on my form that states the number of schedule for that account, is it possible that if say the account i am working on is a 2 schedule account, that it disables the 1 and 3 buttons?
Including check boxes (representing the query fields) in an interactive access form, in order to decide which fields should be visible.
I think the solution is building an invent in VBA for each check box, however I'm not an expert in Access VBA and don't know how to write the code.
In the example that I've uploaded, in the Form1, when I run the query, all fields are displayed, i.e. VENDOR, REGION, CUSTOMER and MATERIAL are displayed. How can I manage it in the form with a listbox to display only the REGION or MATERIAL for instance.
I'm currently using a Dlookup function to display a calculated field from a query. This works fine when only one record is entered on the many side; however when additional records are entered it doesn't add the additional records. What function/code can I use to add each record's total as it's entered on the many side?
This is what is working when the many side only has one record:
=(DLookUp("[qryTotalBalance]![NetBalance]","[qryTotalBalance]","[CustID]= " & Nz([CustID],0)))
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]
Ads: Technewonline is a website that specializes in introducing the latest technologies such as Best Tablet Android Have Price Under $200 and Best tablet of Apple in 2014 and The Best Midrange Smart Phone In 2014 and Top Best Ultrabook Of 2014 and The Best Phones 4G Valued At Under 300 USD is also a website for sharing your tips about computers, mobile phones and tablets, products are available from leading supermarkets will surely satisfy you.
But when I view the form the field displays the following:
#Name?
I have a form which has a few calculations on which are:
TotalPrice - =Nz([Quantity])*([UnitPrice])
Then at the bottom to calculate it all:
=IIf(Sum([Quantity]*[UnitPrice])=0,0,Sum([Quantity]*[UnitPrice]))
This has been working perfectly fine however the TotalPrice is no longer calculating the UnitPrice x Quantity and the TotalCost isnt calculating as nothing appears in the TotalPrice. However when we click the fields the data is diplayed but only on clicking, if we leave the record and go back its back to blank again.
I would Like to save the data to our Table
[InvoiceTotal] - [InvoicePersonal] "if Invoice Personal contains a value" = [InvoiceShareLoan]
If "InvoicePersonal" does not contain a value, no calculation will be made
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 RelatedIs this possible? In my invoice form I have 3 different tax rates. I have put a calculation in each of the Control Sources to calculate the invoice sub total:
=[Invoice Sub Total]*0.13 =[Invoice Sub Total]*0.05 =[Invoice Sub Total]*0.09975
I don't always use all the tax rates. I would like to be able to go back into a tax rate field I don't need and delete it.
i have a form where I enter two dates i.e. a commence day and a final day and I also have a save button.I would either
a. have a control on the save button which pops up a message if the final day is greater than the commence day and so preventing the save record
b. Or if the final day is entered and is recognised as a date before the commence day then to pop a message saying so and preventing the save record.
I have a form with the following:
A combo textbox with Category A and Category B.
An Amount textbox.
In the form footer, I have a textbox calculating the sum of the Amount.
This works fine but how do I create a textbox that calculates just the Category A or Category B??
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?
I have created a From with some Fields: Name, Surname, Netto Price, Tax (%) and Gross Price..... to make a invoice.
The Problem is that i cant insert the data from: Tax and Gross Price in to the DB.I have tried this:
select Tax Field--> Property Sheet -> Control Source: =[Price]*0,19
example:
Netto Price: 100
Tax 19%-- =[Price]*0,19 = 19
Now I get the correct values displayed in Field Taxes.But this this sum cant not insert in to the Database.I use MS Office 2013.
I have an unbound text box with the following control source:
="The scores below are based on the number of total evaluations (" & Sum([TitleIDCt]) & ")."
I set the formatting of the control to Standard. It reads:
The scores below are based on the number of total evaluations (1718).
I need the comma to show up so it reads like this:
The scores below are based on the number of total evaluations (1,718).
Can this be done?
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.
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.
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.....
I have a totalquery that runs fine and give me the sum for both fields I'm looking for but I can't get the outputs to fill the fields on the form. I have tried the Dcount query in the control source but that just returns an error and locks up access.
Code:
SELECT [Tble-wcDelays].Causedby, Sum([Tble-wcDelays].HoursDelay) AS SumOfHoursDelay
FROM [Tble-wcDelays]
GROUP BY [Tble-wcDelays].Causedby, [Tble-wcDelays].LinkingID
HAVING ((([Tble-wcDelays].LinkingID)=[Forms]![Frm-ePlusCent]![cleanID]));
That is the query.
Trying to create a calculation in a field (text25) that excludes weekends and holidays. I am getting an argument not optional error.
Code : Me.[Text25] = GetBusinessDay([Due_Date - Result_Date])
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.
It is like a date calculator.
1. I have 12 unbound text boxes in the unbound form in 6 pairs.
2. Text1 receives the arrival date and Text2 receives departure date, Text3 receives arrival date and Text4 receives the departure date and so on.
3. A person may have any number of arrivals and departures between 1 to 6.
4. The person should not stay in this country for more than 6 years.
I need to calculate from the final departure date, the total number of days the person stayed in this country and the remaining allowable years months and days the person can stay in this country ( deducted from the 6 years period ).
5. Please note the final departure date can be in Text2 or Text4 or Text 6 field.