Multiplying Columns With A WHERE Condition

Nov 2, 2013

I have a table called tbl_IE which has a field named frequency.

I want to multiple all of the values in frequency where the ID is 1. I want to display this on the form as the data is inputted and also on the final report.

View Replies


ADVERTISEMENT

Multiplying Hours Help

Sep 13, 2005

I've searched and searched to no avail to find the answer, hopefully you can help.

The story is:

At work, our holidays are now taken as hours off. For example...if I take a Monday off, its 8hrs and 5 min and a Monday morning would be 4hrs and 5 min...What I want to do is calculate how many hours I have taken off throughout the year.

The way I was going to do it was:

Create Table called Times,

Fields = Week, Day, Morning, Afternoon, Friday and 1hour all Data Type "Date/Time"

Week = 37hrs, Day = 8hrs 5min, Morning = 4hrs 5min, Afternoon = 4hrs, Friday = 4hrs 40min, and 1hour = 1hr.

Then create another table called Hol Booking

Similar field names Wk, Days, Morn etc. They would be Data Type "Number"

Now in my simple head, I thought I could simply record how many weeks or days off i had off. Then create a query (for example) Week*Wk to calculate the amount of hours I had off.
In simple terms if I had 2 weeks and 2 days off, the query would multiply Week (37) by Wk (2) and Day (8:05) by Days (2), giving a total of 90 hrs and 10 min.

I know there is a datatype mismatch, but is there a way round this.

Thanks for listening

View 2 Replies View Related

Multiplying Two Fields

May 16, 2007

hey, i would like to see in the room price column, the total price payed for the room judging by the loyalty(no of nights). So basically i want the loyalty(no of nights X roomprice. At the moment, when i run the query it in the room price it shows just the one night price, but i want to X that by how many nights the person has stayed. I have tryed putting the sum function in the roomprice field and it didnt work.

Thanks.

View 1 Replies View Related

Multiplying A Value In Textbox To A Value In A Table??

Feb 21, 2006

Hi all,
I have a table shown in a form, beside that table a textbox with a button.
How can I multiply the numer entered in that textbox by the the number displayed in the table, and view the result in the same table??
Please help me as soon as possible?

Thanks in advanced and sorry for bothering you.....

Regards,

View 2 Replies View Related

Queries :: Multiplying Two Values From Same Column

Nov 26, 2013

Names Number1 Number2
Name1 1 2
Name1 2 1
Name1 3 -2
Name1 4 2
Name1 5 5
Name2 1 2
Name2 2 5
Name2 3 2
Name2 4 5
Name2 5 -1
...

For each Name, Number1 will always contain the values from 1 to 5. Number2 can vary, however.

I need constructing a query that, for each name, will look at the values in the Number2 column when Number1 is 1 or 2 and multiply them. So, the result I'm looking for is:

Name1 2
Name2 10

(Since 2 = 2 x 1 and 10 = 2 x 5)

I haven't had much look Googling (most search results involve multiplying two columns together, which isn't exactly what I'm after).

View 1 Replies View Related

Queries :: Multiplying Fields From Different Tables

Jul 5, 2013

I'm trying to create a query that will return a calculated field called "PnL".The formula for "PnL" is as follows: PnL = notional*management_fee*NAV*

The "notional" field is a value derived from a table called "Deal_information" (primary key deal_id) and has an associated "management_fee" and "product" field. So obviously finding the product of the notional field and the management_fee field isn't a problem.

However "NAV" field is from another table (VL_information) that contains the historical Net Asset Value of each product. Fields are (VL_id, vl_date, product, NAV).

Therefore for each "notional" record I would like to return the historical PnL.By way of example. Lets say that the notional valuefor a particular record is $100, with a corresponding management fee of 10% (the managment fee is product dependent). Then I would like to find the evolution of PnL by multiplying this record by the evolution of the NAV. This would do so for each notional value.

View 11 Replies View Related

Multiplying Two Fields In A Form From Different Tables

Nov 2, 2011

I have two tables 'LabIssue' and 'Store'.

I created a form for 'LabIssue' in which data will be entered. In the form I want to calculate the 'ChemicalAmount' by multiplying 'Store.Costperunit' with the 'QuantityIssued' which will be entered by the user. ChemicalAmount and QuantityIssued will be stored in 'LabIssue' table. I tried it through the expression builder but im getting #Name? error, did alot of things but couldnt figured out whats the problem.

I am attaching the initial database also for reference.

View 1 Replies View Related

Multiplying Currency Times Elapsed Time

Nov 7, 2007

I have a query that calculates elapsed time from TimeIn and TimeOut formatted to hours and minutes. I need be able to mulitply the elapsed time by the hourly wage in order to find the hourly pay.

How do you format the time so that it is compatible to multiply with the wage?

My SQL statement is below. Thanks for your help.

SELECT tTimeCards.ValetFirstName, tTimeCards.ValetLastName, Format([TimeOut]-[TimeIn],"hh:mm") AS HoursWorked, [HoursWorked]*[tValets]![HourlyWage] AS HourlyPay
FROM tValets INNER JOIN tTimeCards ON tValets.ValetID = tTimeCards.ValetID;

View 8 Replies View Related

Modules & VBA :: Union All Query - Transposing Columns To Rows With Variable Columns?

Aug 8, 2013

I was able to use the UNION ALL qry. But, when I have another file (like original2) that does NOT have all the columns listed in the UNION ALL qry, I get a Parameter value box asking for the missing columns when I run the qry.

Example:

original1IDDateGroupChristianJohnnySteve 18/5/2013A1528/5/2013B338/5/2013C2348/5/2013D2358/5/2013E5

original 2IDDateGroupChristianJohnny18/6/2013A212528/6/2013B2338/6/2013C2248/6/2013D22

The UNION ALL qry includes all the possible resources ( includes all the possible column fields Christan, Johnny, and Steve).

When I run the UNION ALL qry with the original2 file, An "Enter Parameter Value" box is displayed with the mssing column name "Steve".

Is there a way to Map the original2 table into a working table with all the columns, or use VBA code to construct the UNION ALL qry to only include the existing columns? My data has variable columns and I'm trying to avoid the parameter popups.

View 2 Replies View Related

Queries :: Consolidate Multiple Columns Into Two Columns

May 14, 2014

I have a MS ACCESS 2010 database with a data table which i am trying to create a query from. I have 6 columns of data( one with an ID Field and 5 Name Fields). Below i have made examples of how it first appears as a simple query and the second will show you what i would like it to look like.

What the simple query looks like: [URL] ...

Second what I want the query to look like: [URL] ....

View 2 Replies View Related

How Do I: Sum Of Selected Columns & Linking Columns

Oct 30, 2007

Currently I'm building tables and forms. My first table (called Clients) lists the details of fictional clients. My second table is for invoices.

In my invoices table, I wish to link the column for client reference (note: stored in the Clients table) to the column that precedes it. This column will list the clients’ names and is selected from a drop down list that is linked to the Clients table.

What I want to do (if its possible) is to have the respective client ref. automatically show up in the next cell once I've selected the client to whom the invoice relates?

Am I making sense? Is that possible? If so, how do I do it?

Secondly, how do I do a sum of selected columns for my “totals” column? Basically, I want to add the figures found in several cells that precede it?

View 4 Replies View Related

Totalling Columns & Rows Into Columns

Mar 22, 2007

I'm affraid my confusing topic title is an indicator of how confused I am by this. I can't even understand the variables well enough to fully utilize Access Help or the Search function here...

What I have is a database hat has column headers that look something like this:
Customer_Name, Order_Date, Qty_Ord, Unit_Price, Total_Price

What I'm trying to get is a query output that will have

Customer_Name, Total Orders (in Dollars) for January, Total Orders (in Dollars) for February, Total Orders (in Dollars) for March, etc.

I've been able to set it up to SUM for one month, but not multiples.

I know I'm totally lame (for proof read any of my previous posts) but you guys totally bailed me out the other time I asked a lame question.

Thanks in advance!

View 3 Replies View Related

An SQL Str Using IF Condition

Sep 19, 2005

Good morning


I am hoping some one can help me out with an SQL string I am having problems during to get working.

This is my code

Private Sub SearchRoleSeeking()

Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim strSQL As String
Dim strFilterSQL As String
Dim txtBoxValue As String
Set db = CurrentDb
Set qdf = db.QueryDefs("qrySearch")

lstSearchResults = txtSearch1

If Me.txtSearch1.Value = "Temp" Then
txtBoxValue = 1
End If
If Me.txtSearch1.Value = "Perm" Then
txtBoxValue = 2
End If
If Me.txtSearch1.Value = "Temp or Perm" Then
txtBoxValue = 3
End If
strSQL = "SELECT tblPersonalInformation.[PersonalID],tblPersonalInformation.[Surname],tblPersonalInformation.[Forename],tblPersonalInformation.[DOB],tblPersonalInformation.[WantedRate],tblPersonalInformation.[WantedSalary],tblPersonalInformation.[Status],tblPersonalInformation.[RoleSeeking]" & _
"FROM tblPersonalInformation " & _
"WHERE tblPersonalInformation.RoleSeeking = ('txtboxvalue')"


qdf.SQL = strSQL
Me.lstSearchResults.RowSource = "qrysearch"

Set qdf = Nothing
Set db = Nothing

End Sub


let me try explain what I am trying to do.
I have a form where personal information is entered into. It has an option group that allows 3 choices.
I have made a form that I will use to search (the above code is from that.) What I am trying to do is if a person enters "Temp" into txtSearch1 then for the SQL statement to search "tblPersonalInformation.[RoleSeeking]" for the value 1.
If a person enters "PERM then for the statement to use 2 as the value for txtSearch1 and so on.

Can anyone help out with my task at hand.

Thanks everyone for your help.

View 1 Replies View Related

Where Condition Help

Apr 6, 2007

Please don't criticize the naming, I've renamed to make the logic simpler to understand.

I am trying to run a query based on the value of a textbox. Right now if the text box is empty it shows all the records. This is what works:
SELECT A.ID, B.Weight
FROM A
LEFT JOIN B
ON A.ID = B.ID
WHERE B.Weight Like
IIf([forms]![Form]![txtBox] & ""="","*",[forms]![Form]![txtBox])

The problem is when tbl B is blank (and only when its blank), I also want to see all records where weight is null.

Some examples of what I've tried (I have tried variations of):
B.Weight Like IIf([forms]![Form]![txtBox] & ""="","* Or Is Null",[forms]![Form]![txtBox])
B.Weight IIf([forms]![Form]![txtBox] & ""="","Is Null or Like *",[forms]![Form]![txtBox])

I am not worried about the False condition, the problem is that Null is not being returned from inside an IIF().
When I set the WHERE statement to: WHERE B.Weight Is Null, it works. But if I try IIf([forms]![Form]![txtBox] & ""="",Is Null,[forms]![Form]![txtBox]). It doesnt work (Whether I put it in quotes or not).


Any help would be appreciated. Thank you.

View 1 Replies View Related

Sql Command Or Condition

Jun 11, 2006

hi i was wondering if anyone can tell me a condition or a command in which a user will be able to enter only 6 digit number. like 123456. if he tries to enter 234 the database should not accept. is this possible also? any help would be great.
Thanks

View 14 Replies View Related

Evaluate A Condition

May 11, 2007

Please have a look at the following code (I am not good at VBA or SQL).

Me.[txtBox] = DLookup(“[SNum]”, “[Table1]”, “[RecID])
If Me.txtBox =>2 Then
Condition if true
Else
Condition if false
End If

I type a value in my [txtBox], a number. I want to evaluate if the typed value meets the condition or not. [SNum] is serially numbered and [RecID] is autonumber Primary Key. The above code is not working. How do I achieve this? Please help.

View 2 Replies View Related

IIF Condition With 3 Options

Sep 23, 2005

:o Please help... I am trying to get the following results. If the Qty is less than 99 bag 10 per, if the qty is between 100 and 999 bag 100 per and if the qty is greater than 999 bag 200 per.

Pkg Qty: IIf([QTY]<=99,"10 PER",(IIf([QTY]>99,"100 PER",IIf([QTY]>999,"200 PER"))))

I am only getting the results of "10 PER" AND "100 PER". How do I get the results I want?

View 5 Replies View Related

Yes/no Condition For Query

Mar 1, 2006

i have a Yes/No checkbox to indicate whether a job has been done.. if it is done then i want it removed from the list.. so i think my query sql needs to be something like..

note..the bold bit is the bit i am questioning.

WHERE (((Booking_Main.Job_Date) Between Date() And 1+Date())) AND Booking_Confirm.Job_Done ="No"

or something like this??

View 3 Replies View Related

Yes/no Condition Not Working

Mar 2, 2006

i have created a search form. any word the user types it searches certain details in my enquiries.
in my form i have a list box that displays the enquiries sent by my query.

i have placed a Job_Booked (Yes/No field) checkbox in my enquiry table. this is because if the job is booked then i no longer want the record to appear in the enquiry list im sending to the form. ive tried this code, but even when i tick the job booked button, the enquiry is being displayed.. why is this


SELECT zEnquiries.Enquiry_Date, zEnquiries.Job_Date, zEnquiries.Job_Day, zEnquiries.Job_Time, zEnquiries.Enq_Forname, zEnquiries.Enq_Surname, zEnquiries.Pickup_Add, zEnquiries.Pickup_Post, zEnquiries.Dest_Add, zEnquiries.Dest_Post, zEnquiries.Quote, zEnquiries.Car, zEnquiries.Passengers, zEnquiries.Luggage, zEnquiries.Notes, zEnquiries.Job_Booked, *
FROM zEnquiries
WHERE (((zEnquiries.Enq_Forname) Like '*' & Forms!Enquiry_Search!Search2 & '*')) Or (((zEnquiries.Enq_Surname) Like '*' & Forms!Enquiry_Search!Search2 & '*')) Or (((zEnquiries.Job_Date) Like '*' & Forms!Enquiry_Search!Search2 & '*')) Or (((zEnquiries.Enq_Phone) Like '*' & Forms!Enquiry_Search!Search2 & '*')) Or (((zEnquiries.Dest_Add) Like '*' & Forms!Enquiry_Search!Search2 & '*')) Or (((zEnquiries.Dest_Post) Like '*' & Forms!Enquiry_Search!Search2 & '*')) Or (((zEnquiries.Pickup_Add) Like '*' & Forms!Enquiry_Search!Search2 & '*')) Or (((zEnquiries.Pickup_Post) Like '*' & Forms!Enquiry_Search!Search2 & '*')) And zEnquiries.Job_Booked=False
ORDER BY zEnquiries.Enquiry_Date DESC;

View 2 Replies View Related

Multiple Condition IIF

Nov 13, 2007

I can't get this expression in Query to work! Any suggestions?

Account Type: IIf([parent account name] like “*hosp*”,"Hosp",IIf([parent account name] like "*vet*”,"Vet",IIf([parent account name] like “*dds*”,"DENT”,IIf([parent account name] like "*dmd*”,"Dentist”,IIf([parent account name] like "*pharm*”,"Pharm”,0)))))

as you can see I am doing search and identify for a new field.

I get an error message "the expression you entered contains invalid syntax"

View 5 Replies View Related

Where Condition In Report

Mar 13, 2005

i have a form of Employee Info, where with navigation button i move to the next employee.
i have put a Command button to Preview Report on Single Employee Info that i am reading currently.
So i want to Filter the Report with Single Employee Name and records
so im coding on click even of the command button (see below) and its giving me null report.

im using where condition to filter the report and assign to it a variable employee name from the form. Reminding that source codes of both Form and Report is the same

X = Form_frm_MainCurrent.EmployeeName.Value

stDocName = "rpt_All"

DoCmd.OpenReport stDocName, acPreview, , "EmployeeName = X"

anyone got any clue to help me out?

Thanks for your time

View 2 Replies View Related

Checkbox As A Condition

Mar 8, 2006

i'm making form from query. but all i need to do is calculate days worked (TimeService) either worker still working or resigned.

i want to know is it possible to make it condition like it to query? if not can u tell me the other way?

View 2 Replies View Related

IF Condition On A Form

May 9, 2006

Hi everyone, i have a form for bookings. People book by entering (among other stuff), the date and the booking slot.

Basically, what i need to do is have it so that only certain booking slots can be chosen on differnt days... for example, the booking slot of "Eve Extension" can only be used when the date refers to a Friday or Saturday, any other days it would not be allowed.

Is there any fool proof way of doing this, keeping in mind i dont exactly know VBA at all....

cheers, dragon

View 3 Replies View Related

Condition For New Record

Sep 9, 2006

What method(s) are available to detect when a user is at a new record? I really just want to change the .text property of a combo box when the user is creating a new record. If this sounds stupid, I can explain the specifics.

View 6 Replies View Related

Modules & VBA :: AND In Where Condition

May 21, 2014

I got this code to run correctly, which pulls records where they are not junk(can be seen at end of where condition), the only issue is that the "AND" does not turn blue. Is this a problem?

Code:
If Not IsNull(Me.txt_last_rec_id) Then
'DoCmd.SetWarnings = False
SQLText = "INSERT INTO tbl_batt_id " & _
"(record_num, bat_id, manufacture, date_code, barcode, status) " & _
"SELECT " & Me.record_num & ", bat_id , manufacture, Date_Code, barcode, Status " & _
"FROM tbl_batt_id " & _
"WHERE record_num = " & Me.txt_last_rec_id & " And [Status] <> 'Junk'"

[code]....

View 3 Replies View Related

Where Condition Larger Than 255

Feb 24, 2015

I'm trying to put in a Where Condition for an ApplyFilter action, but it only allows up to 255 characters, I need more. I have very little experience using code!I want this to be the Where Condition:

Code:
[Program Name] Like "*" & [Forms]![Program List]![Text34] & "*" Or [Organization] Like "*" & [Forms]![Program List]![Text34] & "*" Or [Program Type] Like "*" & [Forms]![Program List]![Text34] & "*" Or [Main Office City] Like "*" & [Forms]![Program List]![Text34] & "*" Or [Main Office Province] Like "*" & [Forms]![Program List]![Text34] & "*"

How do I make this into the Where Condition? An full example would be nice.

View 7 Replies View Related







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