Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sum function in access 2010 query problem

Status
Not open for further replies.

Panchovia

Programmer
May 6, 2010
48
CW
I've tried to get a sum in access 2010 of my transaction table joined on my client table properties unique records

Payments:sum((([quantity*Price)))
The query result gave me 3 totals, for the three years of transactions in the transaction file.

Is it possible to get one sum of all the years in one total.
 
When you remove the groupby you get an error try to execute a query that does not incude the specified expression as part of an agregate
 
Correct,
quantity and price must be sum not groupby
 
Hi Dhookom

thanks for your advice

now this query is use to print two clientinfo files one if there are transactions, this one works fine( the user will input clientnumber)

the other if there is no data print (clientinfo2)(on no data)
code I used in the onnodata

MsgBox "There are no transactions in the transactionsfile I will print clientinfo of the mainfile"
DoCmd.OpenReport "clientinfo2", acViewNormal, ",", acNormal

how do I pass the clientnumber supplied by the user to the onnodata code to the docmd.openreport


 
Dhookom

is the following where clause code correct
If Me.Recordset.RecordCount = 0 Then
MsgBox "No data in transaction file"
DoCmd.OpenReport , acViewPreview, clientinfo3, where(Number) = (clientnumber)
End If
 
Your OpenReport line has lots of issues. Search Help to find out the correct syntax which states:
Code:
expression.OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs)

Code:
Docmd.OpenReport "Your Report Name", acViewPreview,,"Your Where Clause"


Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top