Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Problem with a sql command

Author  Topic 

Taxidriver
Starting Member

1 Post

Posted - 2005-01-31 : 11:34:49
Hello, I'm getting crazy with a query.
I write the following line in a vba application

select * from qryEdizioni where Titolo = 'Wo hu cang long'

Set rs = dbs.OpenRecordset(sql, dbOpenSnapshot)

then I get rs.recordcount = 1

The problem is that if I do the same query, exactly the same!, using the query window I get the correct record numbers (in this case 2).
Help me, I'm totally desperate, I cannot work it out.

nr
SQLTeam MVY

12543 Posts

Posted - 2005-01-31 : 12:44:25
Maybe you don't get the correct recordcount until you move to the end of he recordset or close it.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-01-31 : 14:52:45
rs.movelast
rs.movefirst
MsgBox "Count of records: " & rs.recordcount




Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

Doug G
Constraint Violating Yak Guru

331 Posts

Posted - 2005-01-31 : 20:36:07
Some things that cause recordcount to fail are pointed out in the documentation

http://msdn.microsoft.com/library/en-us/ado270/htm/mdprorecordcount.asp


======
Doug G
======
Go to Top of Page
   

- Advertisement -