473,394 Members | 1,916 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,394 software developers and data experts.

please help an access noob

So I have this query that returns
ID Item Quantity
primary text int
unique
I have a form with a command button that runs a function, but I need
the function to be able to tally the quantity for each unique item.
I don't understand how to loop a record set in a function nor do I know

how to add unique Items to a new table.
I figure this should be rather simple, please help.
Thanks in advance,
Derek

Nov 13 '05 #1
3 1258
"pointBoarder" <De*********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
So I have this query that returns
ID Item Quantity
primary text int
unique
I have a form with a command button that runs a function, but I need
the function to be able to tally the quantity for each unique item.
I don't understand how to loop a record set in a function nor do I know

how to add unique Items to a new table.
I figure this should be rather simple, please help.
Thanks in advance,
Derek


Normally this is done in a simple query with no need to create any summary
table. When looking at the design of your query, select View>Totals you
should have "Group By" under the item field and Count under the ID column,
so you would have something like:

SELECT Item, Count(*) AS MyCount FROM MyTable GROUP BY Item
Nov 13 '05 #2
in table design, create a 'unique' index on the 'item'

in your function, use a query based on your existing query that
SELECT item, sum(quantity) from yourQuery group by item

Nov 13 '05 #3
"Justin Hoffman" <j@b.com> wrote in message
news:d7**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
"pointBoarder" <De*********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
So I have this query that returns
ID Item Quantity
primary text int
unique
I have a form with a command button that runs a function, but I need
the function to be able to tally the quantity for each unique item.
I don't understand how to loop a record set in a function nor do I know

how to add unique Items to a new table.
I figure this should be rather simple, please help.
Thanks in advance,
Derek


Normally this is done in a simple query with no need to create any summary
table. When looking at the design of your query, select View>Totals you
should have "Group By" under the item field and Count under the ID column,
so you would have something like:

SELECT Item, Count(*) AS MyCount FROM MyTable GROUP BY Item


Sorry, I mis-read the question. The above counts the records per item when
we should be summing the quantity, ie

SELECT Item, Sum(Quantity) AS MySum FROM MyTable GROUP BY Item


Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: administrata | last post by:
Is it possible? I tried... I = "John" print \ """ I used to love pizza"""
4
by: Shane | last post by:
I would like to update Access by using a txtBox. Is it possible to update Access this way? Example: If I selected the txtBox and input a line of text I would like that line of text to be sent...
13
by: nuti | last post by:
Hi all, I am fairly new to VB.I am trying to figure out as how to write a script so that i can read the data from an excel sheet to Access. can u guys please help me out? cheers, nuti
5
by: Sjaakie | last post by:
Hi, To make data-life a little easier, and not having to declare a SqlConnection on each page, I came up with this Sql-Data-class: ' --------------------------------- using System; using...
3
by: scottevanshill | last post by:
I have this silly query in access 2003, i keep needing to remove certain id's from the result, but its gotten so big i'm getting error 3360 access, "query is to complex" This is the problem...
5
by: Hydrogenfussion | last post by:
Hello and thank you for reading this. I have just started to learn C++ from www.cprogramming.com,its a great site! But i do not understand some of the terms. I am using Dev-C++. Can you tell me...
62
by: vubaboota | last post by:
I HAVE SOME SERIOUS PROBLEM , HOW TO MAKE A PROGRAM IN C Q1: Write a program using malloc function. In which you take input from user and allocate memory equal to square of this number. Which...
64
by: John | last post by:
Hello there, Im cursing my place of employment...and its taken me a month to realise it... The scenario: Ive just stepped into a role to migrate an access database to VB.Net. The access...
1
by: Fluffy654 | last post by:
First off I am a complete noob when it comes to doing anything with servers. I'm just beginning to learn today because I need to start adding SSI to my websites. I apologise in advance if I am making...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.