473,395 Members | 1,556 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

vb help in Ms Access: combining selection and group by total

2
Hi there,

I am trying to do a similar thing here with access n vb but with a few additions. Please take a look.

I have a table that looks like this:

ID Product Total
1 aaa 10
2 aaa 19
1 bbb 2
3 aaa 1
2 bbb 3
1 ccc 9
3 bbb 3
...& so on

the ID identifies which month it is.

What i am trying to do is to be able to choose which month (ID) i want say '1' and '3'
and it will hopefully give me a grand total of:

aaa 11
bbb 5

im a real newbie and i have tried changing codes that have been posted here but so far no luck


Big Thanks in advance :)

Matt
Apr 15 '08 #1
2 1289
testar
2
Lol put in a bad intro. i was going to post a reply post to one of the discussions but i thought otherwise so i just copy/paste into a new post without changing the opening sentence. sorry folks.

Matt

Hi there,

I am trying to do a similar thing here with access n vb but with a few additions. Please take a look.

I have a table that looks like this:

ID Product Total
1 aaa 10
2 aaa 19
1 bbb 2
3 aaa 1
2 bbb 3
1 ccc 9
3 bbb 3
...& so on

the ID identifies which month it is.

What i am trying to do is to be able to choose which month (ID) i want say '1' and '3'
and it will hopefully give me a grand total of:

aaa 11
bbb 5

im a real newbie and i have tried changing codes that have been posted here but so far no luck


Big Thanks in advance :)

Matt
Apr 15 '08 #2
JustJim
407 Expert 256MB
Lol put in a bad intro. i was going to post a reply post to one of the discussions but i thought otherwise so i just copy/paste into a new post without changing the opening sentence. sorry folks.

Matt
Hi Matt,

First of all, perhaps ID is not the best field description for a field which represents months.
Anyway... Air code follows (I'm on a train and can't check the code in Access just now)

Expand|Select|Wrap|Line Numbers
  1. SELECT Product, Sum(Total) as GrandTotal
  2. FROM YourTableName
  3. WHERE ID = 1 or ID = 3
should do the trick. Of course it would be more elegant if you work towards letting the code know what months you want before it runs.... but that's another lesson.

Jim

PS I can't help thinking that a GROUP BY clause would be required here. Try it in query design mode and then check the SQL view.
Jim
Apr 15 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: damjanu | last post by:
Hi All; I need little help. I have a datasheet form. I allow user to do 'filter by selection'. My form contains a column with values. As user changes selections, I want to calculate totals....
11
by: Mr. Smith | last post by:
Hello all, My code can successfully open, write to, format and save several worksheets in a workbook then save it by a given name, close and quit excel. My problem is that if I try and do it...
3
by: StBond | last post by:
Hi everyone, I am new to Access and Visual Basic so things my be getting across a bit cloudy. I only started using VB for one week. I am having a little problem with the database that I am...
1
by: BeanCounterCPA | last post by:
OK, I'm sure there is an easy way to do this, but I am just a novice at Access and can not find a solution. I have a database that I used to pull a confirmation sample from by using dollar unit...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
4
by: pokerboy801 | last post by:
OK, I will try to explain this as clearly and as concise as possible. I am using Access, which has three MS Excel Linked tables, to store call center metrics for reps. My Excel workbook has three...
0
MMcCarthy
by: MMcCarthy | last post by:
Rather than using the Access design view change the view to SQL. I am going to attempt to outline the general syntax used for SQL queries in Access. Angle brackets <> are used in place of some...
4
by: dsdevonsomer | last post by:
Hello, I have one simple query joining two tables with left outer join on 3 fields and using MIN on two fields. These two tables have lot of data about 3 mil in total. I am trying to migrate db...
1
by: annemariearmour | last post by:
I am using Crystal reports version 11.2 to create reports. The data source is SQL Server, and I am using views rather than reporting directly from tables. I apply selection criteria to the incoming...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
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...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
tracyyun
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.