Dear all
Am trying to put the following query in a report -
SELECT color, sum(qty*u.p) as total
-
FROM table
-
WHERE flag = "00"
-
GROUP BY color
-
couldnt set the fillter
i tried : - docmd.openreport "rpt", acViewPreview, wherecondition:= "flag = 00 group by color"
i got missing operator errot, but have no idea what operator. rpt is created in design on table table which is the one in the above query
Also i couldt find a wasy to place a textbox in rpt in order to hold the value SUM(qty*u.P)
Any ideass ???
regards,
7 3439
Your WhereCondition includes your group by clause. Your where statement is:
and is seperate from your GROUP by clause:
If flag is a string type field, which it seems to be from your example, you need to include that part in your where condition by enclosing the 00 in single quotes: - docmd.openreport "rpt", acViewPreview, wherecondition:= "flag = '00'"
As for the textbox, place a textbox in the report, and set its controlsource to Total since thats what you have specified it should be called in your query (see the sum(qty*u.p) as total )
Very thanks for your fast reply man, but how can i group the result ??
Also , how can the textbox knows the total even if i assign the controlsource as total, since am not bounding it to that query (the query is an example to show the result i need in the report only), am bounding the report to the table table and am filtering the records upon my where condition only , then i need to get the totals of the filtered records??
I tried ur statement:
it generated the color without grouping where the condition is true
and it calculated the SUM(qty*u.p) on the whole table that has the condition true, and assign that sum to each record
Which means am having unique sum for all records, and records are not distinct or grouped .
With the report open in design view, you can specify a group by. I dont know exactly where this setting is in Ac2007, sorry. Once you have found it, you can also specify that each group should have a group footer. In the group footer you should be able to add a textbox with controlsource:=sum(qty*u.p)
ill check it , then be back with a post.
Hello thesmileycoder
i edited the filter by adding the '' , worked fine.
but when i tried to pass the value in a string like: - docmd.openreport "rpt", acViewPreview, wherecondition:= "flag = ' " & strvalue & " ' AND other = ' " & strvalue2 & " ' "
Where other is another colomn criteria The report opens but with no records even when i switch to design mode after i run the report, am checking the Filter property, and it says flag='00' AND other = 'vx' but as if its not accepting the values since no records showing.
What am i doing wrong ???
Regarding the bound issue, switch to layout mode, click on Group & Sort under Grouping and totals a new bar will show at the bottom of the report, click on Add a group, and select the feild u want to group with, very easy :)
Just to make sure, if you open the report without adding the filter, you DO see your records, right?
Are any of the fields in your recordset lookup columns made with the lookup wizard? (which I recommend against btw)
Other then that I dont have any good suggestions, try posting your reports recordsource SQL.
Well , it seem that the filter wont work if you pass string values , rather than you type the value ie: passing str1 of value 00 wont work
while typing-in the value '00' in the filter property works fine.
Since i created another feild of type number, and i passed multi values(integer values) to the filter and then yoopppiiiiiii , it worked fine :)
but i still am not sure/ or decide if passing string variable wont work, need a little deeper diggggiiinnn .
Numbers worked fine.
Thanks for your help SmileyC. really appriciate.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Wayne |
last post by:
I've been having a click around Access 2007 this afternoon and have
discovered some things that range from annoying to alarming. My
Access 2003 menu bars, which I, like many others, use...
|
by: lupo666 |
last post by:
Hi everybody, this time I have three problems driving me nuts :-(((
(1)
I have a report with 20 or so Yes/No "squares". Is there a way to
either hide/show the "square" or change the yes/no...
|
by: syversda |
last post by:
I have a report that runs a bunch of code to populate variables and then those variables are used as the control source in my report fields.
for example
var1 gets # of records in a table
I...
|
by: LadyIlsebet |
last post by:
I'm not a fantastic Access developer, but I'm trying to help get
Inventory and whatnot organized at work. They are used to 5 year
budget plans that list out exactly what has to be purchased what...
|
by: prakashwadhwani |
last post by:
Hi !! I'm about to develop a new project for a client.
Should I go about it in Access 2003 or 2007 ? Purchasing it either
for me or for my client is not a major consideration here ... what I'd...
|
by: Snoopy33 |
last post by:
I have a DB that I developed on access XP (2002) and deployed over a
year ago. No one has had problems printing any of the reports within
the DB until we started loading 2007 on new computers. ...
|
by: Tony |
last post by:
I am continuing to develop an Access 2007 application which was
originally converted from Access 2003. In Access 2003 I was able to
disable the Access Close button in the top righthand corner of...
|
by: Tennotrumps |
last post by:
I am trying to export a report to excel but the "excel" option is greyed out. I can export the query the report is based on, but not the report.
However, if I open the database on another PC I...
|
by: ghiey |
last post by:
hi to all,
i have searched for a solution regarding exporting access 2007 reports to excel file.
i have converted to access 2007 my database from access 2003.
i guess microsoft omitted the ease...
|
by: Scorp Scorp |
last post by:
Dear All,
I joined newly to Bytes :)
Am stuck in the following issue like a week, and couldent find proper fix :(
I ll try to breif:
I have a recordset, of record count over 4000 records....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |