473,752 Members | 10,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to run sum() Function in VB6?

neo008
85 New Member
Hi All,

How to run sum() Function in VB6?

Adodc1.recordso urce="select sum(quantity) from purchase"
adodc1.refresh

1.) but how to retrieve result in desired text box like i took- AvailabeQuantit y.Text

somewhere i read that query is like "Select sum(quantity) as SumOfQuantity from purchase"

2.) in above statement what is "as SumOfQuantity"

can you please help me

NE☼
Jun 6 '07
13 23126
cmrhema
375 Contributor
I am replying you 3rd time.

I dont know wht's the problem behind this but...

Actually Cmrhema, I have never used Adodb and my entire project is having Adodc connection.

So is it possible to use Adodb for a piece of code without affecting the Adodc code of rest of the project.

NE☼
lookup the previous replu
Jun 6 '07 #11
cmrhema
375 Contributor
I am replying you 3rd time.

I dont know wht's the problem behind this but...

Actually Cmrhema, I have never used Adodb and my entire project is having Adodc connection.

So is it possible to use Adodb for a piece of code without affecting the Adodc code of rest of the project.

NE☼
lookup the previous reply
Jun 6 '07 #12
neo008
85 New Member
Dear Cmrhema,

it's giving error message : "Not a valid file name."

I have put the code....

Expand|Select|Wrap|Line Numbers
  1. Dim MyCon As New ADODB.Connection
  2.                 Dim Myrs As New ADODB.Recordset
  3.                 Dim sConnect As String
  4.  
  5.                 sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  6.                                        "Data Source=" & _
  7.                                         App.Path & "E:\Projects\Rishika Enterprises Project\Database\Rishika070601.mdb"
  8.                 'Replace emp with your file name
  9.                 MyCon.Open sConnect
  10.                 Myrs.Open "select sum(quantity) from purchase", MyCon, adOpenDynamic, adLockPessimistic
  11.                 Text1.Text = Myrs.Fields(0)
  12.                 Myrs.Close
  13.                 MyCon.Close
When I put only Database file name "Rishika070601. mdb" it says can not find file E:\VBProjects\I nventoryRishika 07061.mdb
Jun 6 '07 #13
neo008
85 New Member
Hi Cmrhema,

It's working now.

Thanx a lot. Actually I'm from embedded side and new to VB that's why troubled you so much.

I appreciate your helping nature.

-NE☼
Jun 6 '07 #14

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

Similar topics

4
5612
by: Ben | last post by:
Hi all, I'm trying to figure out how how complex map, filter and reduce work based on the following piece of code from http://www-106.ibm.com/developerworks/linux/library/l-prog.html : bigmuls = lambda xs,ys: filter(lambda (x,y):x*y > 25, combine(xs,ys)) combine = lambda xs,ys: map(None, xs*len(ys), dupelms(ys,len(xs))) dupelms = lambda lst,n: reduce(lambda s,t:s+t, map(lambda l,n=n: *n, lst))
4
79486
by: gooday | last post by:
Table test2 has multiple amounts for each account, I would like to sum the amounts for the same account and use the result to update the variable 'tot_amount' in table test1. But SQL does not allow me to use sum function in update. Is there any other way to do this? Thanks. update test1 set tot_amount=sum(b.amount) from test1 as a join test2 as b on a.acc_no=b.acc_no
6
4082
by: un[real] | last post by:
Like I said in the title, I have to calculate the sum of the numbers of an interger with a recursive fonction. Exemple: n=1255, sum= 1 + 2 + 5 + 5= 13 Do I have to use a string on can I use a simple cin ?? Thanks for your help !! And sorry for my english :)
2
15068
by: Scott Cannon | last post by:
I am trying to query 3 tables all related by Clinet_ID. The Clients table, Monthly_Expenses table and Monthly_Income table. Each client can have 0>M instances of expenses, past due expenses, and income so I am using the SUM aggregate function to get the totals for the Monthly_Epenses.Amount, Monthly_Expenses.Past_Due_Amount, and Monthly_Income.Amount. Then problem I am having and cannot seem to resolve is that the Monthly_Income is...
52
3971
by: Paddy | last post by:
I was browsing the Voidspace blog item on "Flattening Lists", and followed up on the use of sum to do the flattening. A solution was: I would not have thought of using sum in this way. When I did help(sum) the docstring was very number-centric: It went further, and precluded its use on strings:
2
7603
by: dwasbig9 | last post by:
Hi Group (fairly limited knowledge of Access and almost none of Access VBA. Using Access 2003). I need to sum time, I've found through the groups archive an sql extract that led me to this SELECT Format(Sum(Table2.time),"Short Time") AS SumOftime FROM Table2; Which works fine but the article also said I would need a Function to
2
1901
n8kindt
by: n8kindt | last post by:
i don't know what to do about this one. there are some very strange things going on. i have a continuous form with a bound textbox and a bound toggle button. the textbox is named "Payment" and the toggle is named "Apply." i want to have a textbox in the footer (named TotalPayment) that calculates the sum of whatever is in the textbox, provided that the bound toggle button is set to True. i created a function for this purpose. here it is: ...
54
8356
by: bearophileHUGS | last post by:
Empty Python lists don't know the type of the items it will contain, so this sounds strange: 0 Because that may be an empty sequence of someobject: 0 In a statically typed language in that situation you may answer the
7
3504
by: cnb | last post by:
This must be because of implementation right? Shouldn't reduce be faster since it iterates once over the list? doesnt sum first construct the list then sum it? ----------------------- reduce with named function: 37.9864357062 reduce with nested, named function: 39.4710288598 reduce with lambda: 39.2463927678 sum comprehension: 25.9530121845
6
2895
by: azegurb | last post by:
Hello, I have one question again i created one table again and in this table i added some another options for ex at the previous table there were only one problem sum of the dynamically added rows in this beside sum i need to sum of the tax for ex: in column1 i added 300 and into 2-nd column i Chose 10% i would like when i chose from drop down box 10% Let in the 2-nd column appear 10% of the value which i addee first column for ex...
0
9031
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8867
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9624
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8295
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6836
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6116
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4921
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3354
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.