Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 2nd, 2003, 07:35 PM
Authorized User
 
Join Date: Aug 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default calculation in VB

hi.. I really new in VB and have one question...

             Item No. and Quantity DateIn
               A 20 03/03/03
               B 10 03/03/03
               A 10 04/03/03
               C 5 05/03/03

* How to get a total for each item? eg. Item A should be = 30

I try to use sum but there are no sum operator in VB...

thank you for your time!
 
Old October 4th, 2003, 05:30 PM
Registered User
 
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

semooth:

Need a bit more information:

Is the data in an array? In a database table? In an ADO recordset?

How you "teach" VB to sum the data will depend on how you have the data stored or retrieved.







 
Old October 5th, 2003, 11:49 PM
Authorized User
 
Join Date: Aug 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello...

the data all in a database table...

Please help..

 
Old October 6th, 2003, 03:27 AM
Authorized User
 
Join Date: May 2003
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Try this
Use Group by function to get the total of each item.
For eg.
select itemno,sum(qty) as quantity from <tablename> group by itemno



Deepesh Jain
VB,VBA & .NET Specialist
Wiley Support Team
 
Old October 6th, 2003, 11:19 PM
Authorized User
 
Join Date: Aug 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

BINGO!!!!

Thank you Mr. Moderator and RRelosa for you kindly attention.





Similar Threads
Thread Thread Starter Forum Replies Last Post
xsl calculation elayaraja.s XSLT 3 July 31st, 2008 04:59 AM
Report Calculation mateenmohd Access 9 December 7th, 2006 03:41 AM
Calculation Grantm Access 3 February 16th, 2004 10:14 AM
calculation in VB semooth Beginning VB 6 1 December 10th, 2003 09:07 AM
calculation in VB semooth Access VBA 1 October 3rd, 2003 05:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.