Thanks Ed. What I'm trying to do is to get the expression in the query to
calculate the difference between the value of txtDomfacsoleqtr in the
present quarter and the value in the previous quarter, hence the reason why
I'm using the DLookup to determine the value in the previous quarter,
txtMonthlabel is the current quarter and txtqtr1 is the previous quarter
which is calculated in another query as DateAdd("m",-3,[txtmonthlabel]) I've
joined the two queries together
I'm actually trying to create a report from a query
I've modified my expression and this is what it now looks like
[Sum of txtDomfactotqtr]-(DLookUp("[Sum of
txtDomfactotqtr]","qryFDASalesv3v2","[txtmonthlabel] = #" & [txtqtr1] &
"#"))
The report is based on a query qryFDASalesv3v2
The controls Sum of txtDomfactotqtr and txtqtr1 are in the query
The control Sum of txtDomfactotqtr is an expression in the query which is
Sum([txtDomfacsoleqtr]+[txtDomfacpartqtr]) which are fields in my table
The control txtqtr1 is an expression in the query which is
DateAdd("m",-3,[txtmonthlabel])
The control txtmonthlabel is a control based on a field in the table on
which the query is based.
That any help?
Tony
"Ed Robichaud" <ed*********@wdn.com> wrote in message
news:W6*******************@monger.newsread.com...
You can't have an "=" in your criteria, as your criteria is only one side
of the equation. If [txtqtr1] is the field/query column, that you wish to
filter on, then use:
[txtDomfacsoleqtr]-DLookUp("[txtDomfacsoleqtr]","tblmaintabs","[txtMonthlabe
l]")
as the criteria.
-Ed
"Tony Williams" <tw@tcpinvalid.com> wrote in message
news:cu**********@titan.btinternet.com... Does DLookup work in an expression in a query? I have this expression
[txtDomfacsoleqtr]-(DLookUp("[txtDomfacsoleqtr]","tblmaintabs","[txtMonthlab el]= [txtqtr1]"))
Which works fine as a calculated control on a form but when I try to use
it
in a query as an expression I don't get any result. I want to use the
Sum of
the result in a query on which I will base a report.
TIA
Tony