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

sum recordsets -please help

66
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 1628
jeffstl
432 Expert 256MB
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 Expert 256MB
If that doesn't work you might have to type cast the values with cint() or something.

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

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

Similar topics

4
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
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...
7
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....
22
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...
6
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....
2
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...
5
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...
16
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...
4
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...
11
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.