473,804 Members | 3,182 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sum recordsets -please help

66 New Member
hi,

i suppose this is a pretty simple thing, i am unsure how to proceed though.

i have 2 recordsets counting items ifrom 2 tables how would i then add these recordsets together.

the recordsets ive used are shown below

Expand|Select|Wrap|Line Numbers
  1. set rs1=cn.execute ("Select count(*) as cardifarrivals from tbl_flight_details WHERE arriving_airport ='cardiff'") 
  2.  
  3. set rs=cn.execute ("Select count(*) as cardiffdepartures from tbl_flight_depts") 
  4.  
these then give results of say 3 and 5 i know want to add these together to give the result in a variable,

or is it possible to select count on 2 tables, and store this in another recordset?
Mar 11 '08 #1
2 1643
jeffstl
432 Recognized Expert Contributor
hi,

i suppose this is a pretty simple thing, i am unsure how to proceed though.

i have 2 recordsets counting items ifrom 2 tables how would i then add these recordsets together.

the recordsets ive used are shown below

Expand|Select|Wrap|Line Numbers
  1. set rs1=cn.execute ("Select count(*) as cardifarrivals from tbl_flight_details WHERE arriving_airport ='cardiff'") 
  2.  
  3. set rs=cn.execute ("Select count(*) as cardiffdepartures from tbl_flight_depts") 
  4.  
these then give results of say 3 and 5 i know want to add these together to give the result in a variable,

or is it possible to select count on 2 tables, and store this in another recordset?
So what problem are you having?

Just add them together.

Expand|Select|Wrap|Line Numbers
  1.  
  2. dim strTotal
  3. strTotal = rs1("cardifarrivals") + rs("cardiffdepartures")
  4.  
  5.  
Mar 11 '08 #2
jeffstl
432 Recognized Expert Contributor
If that doesn't work you might have to type cast the values with cint() or something.

cint(rs1("cardi farrivals")) + cint(rs("etc"))
Mar 11 '08 #3

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

Similar topics

4
5628
by: Marco Alting | last post by:
Is it possible to INNER JOIN two recordsets in ASP? I don't mean the normal JOIN you would use with two tables, but actually join the recordsets in ASP?
2
1593
by: Steve Marciniak | last post by:
I'm trying to display different recordsets (which are 1 field each) as columns right next to one another. For example, Recordset1 is displayed on the left hand side of the screen. Recordset2 is displayed immediately to the right of then first recordset with the first rows or each at the same level. Recordset3 is displayed to the right of Recordset2 and so on. There is no set limit to the number of possible recordsets (or columns to...
7
16552
by: (Pete Cresswell) | last post by:
I posted this in the MS Access group, but no luck. ------------------------------------------ I've got another stored procedure in the same app that returns multiple recordsets and the code works. But now I've written another SP and the code traps out with the 3251 message. The SP is writing two recordsets. When I run the SP in Query Analyzer, both recordsets appear.
22
6143
by: James Cane | last post by:
Here's an interesting problem that someone might have an answer to... Some time ago, I wrote a set of utility classes which wrap up the custom row source function needed to add arbitrary items to a combo or listbox. It all works nicely and allows me to do things such as sorting by clicking on column headings. Recently, all the machines here were upgraded to Access XP from 97 and I thought it might be time to take advantage of the new...
6
2949
by: Steve Jorgensen | last post by:
I keep having problems in which ADO disconnected recordset work under some circumstances, but lose all their data at other times, having no rows or fields, though the recordset object still exists. One case where this happened to me today was in trying to store disconnected recordsets in a cache collection in case they are needed again later in the same session. When I retrieve the recordset from the collection, it's empty. On the other...
2
1769
by: Pieter Linden | last post by:
The answer to this one is probably "test it yourself and find out!", but I'll ask anyway. Pursuant to my previous question - sending separate recordsets to Word using the CreateTableFromRecordset code from ADH2000... I will be opening like 8 recordsets {one for each building, and there are 8). Would I be better off or is there anything to be gained by opening one recordset of the query with _all_ the records in it, filtering that, and...
5
13327
by: Wim Van der Elst | last post by:
Hello, I want to start working in VB.net but seem to have trouble in understading how I get to an equivalent of a recordset as in VB6. The only examples I find are working with binding, but that is not what I want to do. I want to be able to create a recordset and go forward and backwords through it and us it in while not .EOF structure as I did befor in VB6. How is this done in VB.NET. Any axemples out there?
16
5728
by: Randy Harris | last post by:
I was inspired by the recent discussion of returning multiple recordsets to ADO from a stored procedure. (Amazed is probably more accurate). I asked about how to accomplish same with Oracle and got a nudge in the right direction from Mr. Kreft. I promised to provide details once working, so here it is. The code is shown below. My next step is to build this technique into my application. I'm hoping for substantial performance gain. ...
4
1517
by: mrmagoo | last post by:
I'm building a vb.net Forms project that is getting data from a SQL Server database. One of the main goals of the project is to be really responsive to events, such as textbox change events. I have a textbox for searching, a listbox to display the searched results, and a big textbox (memo) to display the clicked-results of the listbox item. My question is: should I load the controls with objects, and therefore store everything in...
11
3142
by: BeckR | last post by:
Hello - Thanks for reading my post. I am a newbie when it comes to VBA programming, but have managed to do what I need to do, until now. I have an Access 2000 database (running WinXP Pro (SP3)). I have successfully created 3 recordsets in my database. What I need to do is to take the data from those 3 recordsets and put them into a table so that I can run reports at a later time. I was able to create the recordsets and the table with...
0
9706
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
10569
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...
1
10315
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9140
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
7615
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
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.