|
-
Jul 19th, 2004, 10:52 AM
#1
Thread Starter
New Member
Record count in VBA returns -1
Hello,
I am attempting to count the number of records returned by a query in VBA. When my query returns less than 100 records I get a correct record count. Anything over 99 and I get a -1 for my record count. Here is my code:
'start code
strConnect = "ODBC;DSN=nip_profile_fabrics_local;UID=;PWD=;Database=fabric_nip_profile.mdb" 'Connection String
strSQL = "SELECT * FROM [Compression Testing];"
Set wrkODBC = DBEngine.CreateWorkspace("NewODBCDirect", "", "", dbUseODBC) 'Create ODBCDirect Workspace
Set conFabric = wrkODBC.OpenConnection("test", dbDriverNoPrompt, True, strConnect) 'Open connection
Set rstFabric = conFabric.OpenRecordset(strSQL, dbOpenSnapshot) 'Open recordset
'need to run through the records to get a good count
rstFabric.MoveLast
rstFabric.MoveFirst
ScrollBar1.Min = 1
ScrollBar1.Max = rstFabric.RecordCount
ScrollBar1.Value = rstFabric.AbsolutePosition + 1
'end code
Help!
Thanks, John
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|