Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return Row Count to Access?

Status
Not open for further replies.

Savil

Programmer
Apr 28, 2003
333
EU
Hi
I have an Access 97 fe with an SQL 2000 be. I am using dynamic insert and update queries generated in Access by creating a string. It would be beneficial for the users to see how many rows are affected when they run these queries. I know it can be done but not quite sure how to do it.
Can anybody point me in the right direction?

Thanks
 
If you are using ADO then you need to populate the connection or command object's recordseffected paramter

ie
Code:
dim i as integer
cn.execute "upate sometable where c1 = 'x'",i
msgbox i & " records were updated"

ps I dont have the dev environment open so although it should work, you might want to expect some editing..

Rob
 
I don't believe ADO is possible in access 97 so I use an ODBC connection string. I have since done some research on the Microsoft website and found a KB article that states on the fly stored procedures using the RecordsAffected property of the querydef does not work, and this is intended. I believe they could'nt get it to work and could'nt be bothered to fix it as they were working on the ADO method, but thats just my opinion. I have decided to rework the form and leave it.

Thanks for your reply
Regards Savil
 
ADO is possible in Access97 (why are you using access 97?)
all you need to do is run the mdac.exe in the system and ado is available to reference.

Re how to do this with DAO/ODBC.. No clue.

I would recomend you look at installing ado and converting your code. (but i know that with an old application this can be a very time consuming process that doesn't offer a cost/time benifit.)

I dont even have access 2 installed anymore. Min version I run is 2k. (quite different)

Good luck

Rob

PS see if your execute method has a records effected method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top