Calculated Query?

Mar 6, 2007

Hi,
I am trying to display all records that are 30 days old from date of registration (& not paid). I have:

30 Days: [SrDate]+30
SrPaid = No

But I don't want to see those that have registered in the (say) last few days, but only those that have not paid and 30 days are up. How would I achieve this?

Thank you

View Replies


ADVERTISEMENT

Calculated Query

Mar 6, 2007

Hi,
I am trying to display all records that are 30 days old from date of registration (& not paid). I have:

30 Days: [SrDate]+30
Paid = No

But I don't want to see those that have registered in the (say) last few days. How would I achieve this?

Thank you

View 3 Replies View Related

How Do I Add Calculated Field To A Query

Nov 23, 2007

I have an inventory transaction file that has quantity on hand as a calculated field. I am trying to add this unbound field to a report using a query but I can't figure out how to add my quantity on hand field to the query since it is a calculated field and not a bound control.

Any help would be appreciated.

Thanks

darrrellx

View 1 Replies View Related

Total Calculated Query

May 4, 2006

Please look at the attached sample db file and the text file explaining the problem.

Thanks

View 1 Replies View Related

Complex Calculated Query?

Jun 20, 2006

Hi everyone,

OK this is a pretty big question, but here it is....

I am not quite sure that a query is the best thing to use in this case, but I think it might be possible. Here is what I need to do: I have a table with information about oil well production. In this table the production of each oil well is recorded once a month (Barels of Oil, Water, and amount of Gas produced, and the number of days that the well produced in that month). This table ranges in dates from 1986 to 2006 and has records every month in that time span. You can see a sample of how the design of this table is in the attachment (Table: [Well Data]).

What I need to do is have a query look at this main table and create another table with some calculated fields. This new table will have only 1 record for each well. You can see a sample of the table that needs to be created in the attachment (Table: [New Table]). In this table, the first 8 columns are not calculated at all, they are just recorded from the main table. The next columns are calculated. As you can see in the attached preview, the query needs to find the first 180 days (6 months) that a well is producing and sum the oil, gas, and water in that time. It also has to do this for the first 365 days (12 months). Then it has to record the earliest date that a well has in the [Well Start Date] column and the latest date a well has [Well End Date]. And last, it has to determine how many total days the well was producing (Subtract [Well End Date] - [Well Start Date]).

I know this is a lot to comprehend, so please ask questions if you don't understand me. I really appreciate your help!!

Thanks,
Chris

View 1 Replies View Related

Max Function In A Calculated Query

Dec 5, 2006

Hello,

I have a query problem and I have no idea how to solve it.

In the query there are 4 fields:

1) ID 2) PageRank 3) PageRankNormalized 4) PageRankValue


1) ID is the Primary Key

2) In the PageRank field there are values from 1 to 10

3) In the PageRankNormalized there is an expression PageRankNormalized: (3^[PageRank])

4) In the PageRankValue there is another expression PageRankValue: ((3^[PageRank])*100)/ Max ( [PageRankNormalized] )


Now when I run the query I get the following error message:

You tried to execute a query that does not include the specified expression 'ID' as part of an aggregate function. (Error 3122)

What I am trying to do is to calculate the PageRankValue (4) through an expression that divide ((3^[PageRank])*100) by the maximum value shown in the calculated field PageRankNormalized (3)

------------------SQL------------------------

SELECT [UNIVERSITIES by name].ID, [UNIVERSITIES by name].PageRank, (3^[PageRank]) AS PageRankNormalized, ((3^[PageRank])*100)/Max([PageRankNormalized]) AS PageRankValue
FROM [UNIVERSITIES by name];

---------------------------------------------


I am stucked and I am not sure how to use this Max function in a calculated query.

Thanks for your help !! :)

FF

View 1 Replies View Related

Using A Calculated Field In Another Query

Nov 15, 2007

I can't seem to find a problem like this already answered....

I have these two calculated fields:

dtmNPacketDue: IIf([strRevTypeNIRB]="Full" Or [strRevTypeNIRB]="Termination(Full)",[dtmNIRBMtgDate]-28,[dtmNExpDate]-28)

dtmCOIDueDate: IIf([strRevTypeNIRB]="Termination(Full)" Or [strRevTypeNIRB]="Termination(Expedited)","N/A",[dtmNPacketDue]-42)

When I use the one in RED in a calculated field in a new query, things are peachy.
But when I use the one in BLUE in a calculated field in a new query, the message is #Error

My Calculated field (which produces an #Error) in the new Query is:

2ndCOINotification: [dtmCOIDueDate]-14

(if I insert [dtmNPacketDue] instead...it works

Perhaps my problem is that dtmNPacketDue (a calculated variable) is part of the BLUE calculated variable....??

Any ideas greatly appreciated....

View 4 Replies View Related

Calculated Field In A Query

Apr 24, 2006

Hola folks.

I am trying to create a calculated field in a query that subtract 2 fields within the same query.

That is, i have a FiscalWeekStart and FiscalWeekEnd pulling from a table. I created a CountofWeek field that count the weeks between the FiscalWeekStart and End using "DateDiff("w",[FiscalWeekStart],[FiscalWeekEnd])".

I also have a HolidayWeek field that pulls from a table using a
Count expression in the query.

My goal is to subtract the CountofWeek and the Holiday week calling it NonHolidayWeek using "NonHoliday Week: IIf(IsNull([CountofHolidayWeek]),[CountofWeek],[CountofWeek]-[CountofHoldayWeek])"

BUT IT IS ASKING FOR PARMETERS ON THE "CountofHolidayWeek".

Thanks for the help in advance.
TukTuk

View 1 Replies View Related

How To Sort By A Calculated Field In A Query?

Jul 21, 2006

I have a query that draws from two tables, and the field in question looks like this:

X: [TableData]![FieldA]*[TableNumbers]![A]+[TableData]![FieldB]*[TableNumbers]![B]


It all works fine and dandy, but once I set it to sort by this field and run the query, it gives me the parameter prompt, asking me to enter the Parameter Value of FieldA and then for FieldB.

Is there a work-around for this within the query?

The only other solution I have in mind is making another table from this query, and then creating another query just for sorting said table, but that seems inefficient at best.

View 2 Replies View Related

Query Of Calculated Field Gives Blank.

Nov 8, 2006

I have the following calculated field in a query:

LoanNo:IIf([Stats].[LoanCnt]>1,[Stats].[LoanCnt] & " Loans",[Loan].[LnNo])

Within its query, it correctly displays the loan number associated with a particular loan.

However, when I run a second query

SELECT LoanNo
FROM qryLoanInfo

it comes up blank for every record (other fields are OK)

Does anyone have any idea what might be happening?

View 2 Replies View Related

Criteria For Calculated Field In Query

Dec 8, 2006

Hi,

I have a calculated field in my query called "outstanding".

this is how the query looks:


Expr: SubFormTotal………………[qty]*[price]

Discount …………………………...[Discount]

Expr:Total………………………….[SubFormTotal]-[Discount]

Deposit…………………………….[Deposit]

BalanceToDate…………………….

[B]Expr: Outstanding…………………..[Total]-[Deposit]-[BalanceToDate]



PROBLEM: i want to search for all the "amount outstanding" that >0 HOWEVER when i put that as the criteria it asks me to enter values for other calculated fields

what am i doing wrong and how can i solve it?

thanks

View 7 Replies View Related

Parameter Query On Calculated Field

Apr 17, 2007

I hope someone can help as I am stumped at present. I have created a calculated query using dateadd. I have a table that has date fields, ServiceContractAgreed and ServiceFrequency. The service frequency field holds a value of 3,6,9 or 12 in months. Using dateadd I can add the months to the ServiceContractAgreed field in a field called NextService, ie =IIf(IsNull([ServiceContractAgreed]),"N/A",DateAdd("m",[ServiceFrequency],[ServiceContractAgreed]))
This works fine but what I want to do now is create a parameter query to search the NextService field, using the between operator to search between dates. I've created a new query to do this but get every record back, no matter what dates I put in. It's probably something really simple to do but I'd be really grateful for any advice!

Cheers

Dave

View 2 Replies View Related

Like Operator In Calculated Query Field

Aug 1, 2007

Good afternoon,

I have a field that contains semester info ie: F07 Sep.

What I am trying to do is using an if statement to test for which month and returning a section number based on the month. I can make it work using an exact match but am trying to make it work on the partial match "Sep" so I don't have to change it next year as F07 stands for Fall 2007

This is what I've tried and various combinations.
Section1: IIf([tblOnlineCoursesDetails]![Semester]="* Sep","70","")

Having trouble getting this to work.

Any help or suggestions would be appreciated.

Thx

Jerry

View 1 Replies View Related

Can't Edit Query Which Has Calculated Fields

Jan 7, 2008

Hi!

I have done a query which has calculated fields, but I can't edit the stored fields directly from the query, instead I have to go to the table so as to edit it. Is this the way it works or is something wrong?

SELECT [INSTRUCCIONES DE EMBARQUE].N_OP, [INSTRUCCIONES DE EMBARQUE].[N° FAC EXP], [INSTRUCCIONES DE EMBARQUE].[FECHA CUMP], [INSTRUCCIONES DE EMBARQUE].[DERECHO PGC], [INSTRUCCIONES DE EMBARQUE].[VTO DER EXP], [INSTRUCCIONES DE EMBARQUE].[IMPORTE REINTEGRO], [DETALLE CONTENEDOR].CANTIDAD, [DETALLE CONTENEDOR].[VALOR FOB], [INSTRUCCIONES DE EMBARQUE].[TIPO DE CAMBIO], [TIPO DE CAMBIO]*[VALOR FOB] AS [PRECIO VTA (ARS)], [PRECIO VTA (ARS)]*[CANTIDAD] AS [TOTAL(ARS)], [TOTAL(ARS)]/[TIPO DE CAMBIO] AS [TOTAL(USD)]
FROM [INSTRUCCIONES DE EMBARQUE], [DETALLE CONTENEDOR];

View 2 Replies View Related

Sort By A Calculated Date In A Query

Apr 1, 2008

I have a calculated date field in a query...if I try and sort by this field I get a data type mismatch.

[CONTREFF] is a date field in a table, [TERM] is a number field in a table. I am trying to calculate the year the contract expires in the "EndTerm" field. The calculation works fine, but I can't sort it.

EndTerm: DateSerial(Year([CONTREFF])+[TERM],Month([CONTREFF]),Day([CONTREFF]))

Please Help!!! Thank you ...

View 3 Replies View Related

Queries :: Calculated Field In A Query

Mar 23, 2015

This is not the normal calculated fields in query's. What I want is different, I want it to be like

IFF(ShowID="A",[TotalSales],0)

Thing I have is, I want to know all the Total sales in on row that has Show A in it and then Total sales for Show B. Problem is, I have over 130 shows. How would do that?

View 6 Replies View Related

Queries :: Calculated Date In Query

Jun 4, 2014

I've been struggling with this for a while, and even though I understand the theory, I can't get my code to work correctly.

I have 2 fields:
CallbackFrequency & Last Contacted.

I want to use these fields to populate a third field (callBackOn) so that we can have a list of candidates that need to be called from a certain date.

CallbackFrequency is added from a combobox, so all values are either 1 Month, 3 Months, 6 Months, or 12 Months.

I have tried creating a calculated field directly in the candidates table, but apparently this is not possible.I've therefore tried to create a query using IIF statement that will calculate this value.To get to grips with the code, I'm only dealing with 1 callbackFrequency at the moment. So far I have:

CallbackOn: IIf([Candidates].[CallbackFrequency]="1 Month", [LastContacted],)

I have not factored in the date manipulation yet, as the query does not display the LastContacted date of the record it finds, it only shows a blank cell,

View 8 Replies View Related

Queries :: Calculated Field In A Query

Nov 25, 2013

I Have some calculated fields in a query and want to update it in the table .So,is there anyway to store these fields.Otherwise can i store this Query data every month in database so that when i re-run the query the previous month data will not be affected.

View 1 Replies View Related

Query Display Value From Calculated, Unbound Textbox

Oct 5, 2007

Here's the situation.

I have a calculated value in an unbound textbox (avghcppmw). I want to run a query (qinsphistory) in which one of the fields is the value of the textbox (avghcppmw).

Is there any way to pull the value from the form and display it in the query. I'm assuming not.

I also assume the only way to do this would be to create a query that would calculate the textbox value and base (qinsphistory) on the newly made query.

Is this correct?

View 6 Replies View Related

Gouping By And Suming Calculated Fields In A Query

Oct 23, 2007

I have been given the unenviable task of processing data from a 700,000 line database. As an seasoned Excel user but absolute Access beginner, I've managed to handle some of the simpler data requests but the latest request has me somewhat stumped. The problem is as follows:

The fields are:
[Loan]
[Valuation]
[Type]

I have created a query that calculates two fields based on this data:

i) [LTV] = [Loan]/[Valuation]. The code I have used for this is:

SELECT IIf([Valuation]=(0),Null,[Loan]/[Valuation]) AS [LTV]

ii) A percentile reference [P Range] calculated using the following code:

IIf([LTV]>0 And [LTV]<0.1,"P0",Null) & IIf([LTV]>0.1 And [LTV]<0.2,"P10",Null) & IIf([LTV]>0.2 And [LTV]<0.3,"P20",Null) & IIf([LTV]>0.3 And [LTV]<0.4,"P30",Null) & IIf([LTV]>0.4 And [LTV]<0.5,"P40",Null) & IIf([LTV]>0.5 And [LTV]<0.6,"P50",Null) & IIf([LTV]>0.6 And [LTV]<0.7,"P60",Null) & IIf([LTV]>0.7 And [LTV]<0.8,"P70",Null) & IIf([LTV]>0.8 And [LTV]<0.9,"P80",Null) & IIf([LTV]>0.9,"P90",Null) AS [P Range]
FROM [BASE TABLE]

I suspect this code is somewhat clumsy but it is the best I have managed so far!

My difficulty is creating an output in the query

First the outputs need to be grouped by [Type] and by [P Range]. Then I need the following other outputs
Count[P Range]
Sum[Loan]
Sum[LTV] in each subgroup

I tried adding a Group By to the query in the design view, but I get an error every time. How do I output this data?

I have tried to read up on this but haven't managed to create a successful query!

I've attached a simplified version of the database as an example and to show where I've got to with this query

Please help!

Thanks

Oli

View 4 Replies View Related

Queries :: Calculated Date Field In Query

Sep 10, 2014

I am having a problem with calculating a date field in a query. Prior to this posting I've done some research and made several changes to my query. This only resulted in fixing one problem but then creating another problem. Original problem was I had 2 fields, arrived (23:36) and stemi (0:07). I use the following calculation AT_ST: DateDiff("n",[arrived],[stemi]) which resulted in -1409. So my research showed me I had a problem with the date whenever the time went past midnight and trying to calculate a zero hour number. I changed my calculation to

AT_ST: IIf([stemi]>=#11:59:00 PM#,(DateDiff("n",[arrived],[stemi])),(DateDiff("n",[arrived],[stemi]+1440) Mod 1440))

This works fine and gives me the result of 31 minutes which is what I want, however the problems comes in when I change to this calculation any where there was a negative time now has a 1400+ plus value. Such as arrived (7:37) and 1st_eck (7:18) = 1426 where as before it would report -14 (yes, negatives are acceptable for my reporting because sometimes a call to the hospital is placed before the patient arrives so we want to report on the negative splits). I've tried using a nested IIF to calculate for stemi time being less than arrived time, this didn't work when I tried to use it on the calculated query field. I was wondering if I could write something to check the value of the calculated field if it is greater than 1440 and if yes - subtract 1440 from it. So in the example above 1426-1440 = -14. Is it possible to do this within the query or do I need to do it using VBA

View 14 Replies View Related

Queries :: Sum Calculated Query Without GroupBy Totals?

Jul 11, 2013

Im trying to run the following calculated query:

Total Value on order: Sum([Purchase Price])

I want to sum the total of all the purchase prices together so I know the total value on order. I keep getting an error: "You tried to execute a query that does not include the specified expression Purchase Order' as part of an aggregate function

View 2 Replies View Related

Queries :: Filter Calculated Query Field

Nov 13, 2014

So I have the following query field which calculates another field.

How do I Filter the records in this calculated field to only return TRUE, as if I put "TRUE" in the Criteria for this field (or anything at all) then a parameter message box pops up asking for [Balance].

Code:
Balance1: IIf([Balance]<>0,"TRUE","FALSE")

View 8 Replies View Related

Tables :: Calculated Field In Query Does Not Work

Mar 17, 2014

I have a

Order Table:

Order ID(Autonumber)
Client ID(Text)
Client Name(Short Text)
Install Gross Rate (Currency)
Install Discount Given in % (Number)
Install Discount Given in GBP (Currency)

Then I designed a Query to calculate the Install Net Rate

Query

I selected
Client ID
Client Name
Order ID

Expression: [Install Gross Rate]*(1-[Install Discount Given in %]/100)-[Install Discount Given in GBP]

I run the query, but only ONE order calculated correctly, rest of Orders returned blank row.

View 10 Replies View Related

Queries :: Selecting A New Calculated Field In Same Query

Aug 30, 2013

I want to calculate a field that is Sales*6+Salary, then in that same query I want to select ONLY the greatest Salary per employee. So for example

SELECT EmpId, MonthDate, Sales, Salary, [Sales]*6+[Salary] AS SalTot
FROM EmpTable S1
WHERE SalTot = (SELECT MAX(SalTot) FROM EmpTable S2 WHERE S1.EmpId = S2.EmpId);

Can I not select a value that has been calculated this query?

View 5 Replies View Related

Forms :: Control Source From Calculated Query

Dec 5, 2013

I'm getting a Name(hash) error when I try to set up a control source to a calculated query.

I'd like to just be able to create a form and the write in the control source as it look neater (and it the right way to do it) then subforming a query for one text box.

I presently have tried in the expression build =[qryCallRunningAverage]![Average]

View 1 Replies View Related







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