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

Retrieve record count

19
Hi I use VB 6.o as my front end... execute a query in Access... by the following code

sQueryName = "[Warranty Update 12 Month Rolling #2]"

adocmd.CommandText = sQueryName
adocmd.CommandType = adCmdStoredProc
adocmd.ActiveConnection = conAdo
adocmd.CommandTimeout = 1200
adocmd.Execute

I wanted to retrieve the record count that is affected ....

can anyone suggest me the syntax
Aug 9 '07 #1
6 2554
MikeTheBike
639 Expert 512MB
Hi I use VB 6.o as my front end... execute a query in Access... by the following code

sQueryName = "[Warranty Update 12 Month Rolling #2]"

adocmd.CommandText = sQueryName
adocmd.CommandType = adCmdStoredProc
adocmd.ActiveConnection = conAdo
adocmd.CommandTimeout = 1200
adocmd.Execute

I wanted to retrieve the record count that is affected ....

can anyone suggest me the syntax
Hi

How about

Dim RecordNum as Long
.
.
.
adocmd.Execute RecordNum

msgbox RecordNum

??

MTB
Aug 9 '07 #2
BSB
19
Hi

How about

Dim RecordNum as Long
.
.
.
adocmd.Execute RecordNum

msgbox RecordNum

??

MTB
\]



hey thank you..it works
Aug 9 '07 #3
BSB
19
\]



hey thank you..it works

One more doubt,

the query that was executed is the find duplicate query
say if the count retrieved is 10...
I need to select all those 10 records
How to do that????
Aug 9 '07 #4
Killer42
8,435 Expert 8TB
the query that was executed is the find duplicate query
say if the count retrieved is 10...
I need to select all those 10 records
If you have a query which returned a bunch of records, and you want to delete them, I believe there are two basic approaches. You can use a modified copy of the query to delete them instead of selecting them (change the "select query" to a "delete query"), or your code can just loop through all the records and delete them, using the .Delete method.
Aug 10 '07 #5
MikeTheBike
639 Expert 512MB
One more doubt,

the query that was executed is the find duplicate query
say if the count retrieved is 10...
I need to select all those 10 records
How to do that????
Hi

I don't normally use the ADO Command objects but perhaps this will do it

sQueryName = "[Warranty Update 12 Month Rolling #2]"

adocmd.CommandText = sQueryName
adocmd.CommandType = adCmdStoredProc
adocmd.ActiveConnection = conAdo
adocmd.CommandTimeout = 1200


Dim rs as ADODB.Recordset
Set rs = adocmd.Execute()


This of course asumes the "[Warranty Update 12 Month Rolling #2]"
is a select query and conADO is an opened connection.

My normal method would be (on the above basis).

Set rs = New ADODB.Recordset
rs.Open sQueryName, conAdo

or similar

Is that what you had in mind ?

MTB
Aug 10 '07 #6
Killer42
8,435 Expert 8TB
Oops!

Sorry about that. I don't know where I got the idea that you wanted to delete them. :(
Aug 10 '07 #7

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

Similar topics

6
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a...
1
by: DaveF | last post by:
How can I retrieve display_names Dim custDS As DataSet = New DataSet Dim mySQL, mySQL2, mySQL3 As String
2
by: rn5a | last post by:
A SQL Server 2005 stored procedure expects a parameter 'UserID' depending upon which it retrieves the no. of records & OrderIDs corresponding to the 'UserID' from a DB table (note that OrderID &...
13
by: kev | last post by:
Hi all, I have created a database for equipments. I have a form to register the equipment meaning filling in all the particulars (ID, serial, type, location etc). I have two buttons at the end...
2
by: Loras | last post by:
Hello all, I'm a newbie in Access vba, so please help... I have some vba code to count records, but i also need retrieve value from query SELECT SUM (......). There will be only one record (Total...
4
by: Simon Gare | last post by:
Hi all, I am trying to retrieve a count of booking entries made 30 days ago, below is the end of the query I am having problems with. dbo.booking_form.TimeOfBooking = DATEADD(day, -30,...
14
by: David | last post by:
Hi, I have a form on which a user can select a checkbox against a record. Each checkbox carries the RecordID of a product. ---------------------------------------------------------------- I...
0
by: tigger | last post by:
Hi there, I'm having problems retrieving data from Access database using Visual basic 2005. My database is called Actual_Database and it has a few tables. One of them is called...
4
by: rakeshop86 | last post by:
I have a query like this... rs.Open "select * from Tab_OrderStat_samp where wrkSlab=" & CmbOrdDt & "", cn, adOpenStatic, adLockOptimistic but when a date is selected in the combo box which is there...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: 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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
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.