ADO Count not correct?
I am running into a wall. I have a program that will be uploading email addresses (from our company) from one access database to a SQL database adding new ones as necessary. I am using ADO.
SO I open the recordset,
CustConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Customer.mdb"
CustConn.Properties("Jet OLEDB:Transaction Commit Mode") = 1
Then I generate one recordset to get the number of records for Unique Email addresses.
SQL = "Select Count(Distinct([email_address])) as EmailCount from Customer_Info where trim([Email_Address]) <> '' and [Exclude_Email] <>'Y'"
CustRS.Open SQL, CustConn, adOpenForwardOnly, adLockReadOnly, adCmdText
This returns 29979 records.
Then I gather those records.
Set CustRS = Nothing
SQL = "Select Distinct ([email_address]) from Customer_Info where trim([Email_Address]) <> '' and [Exclude_Email] <>'Y'"
CustRS.Open SQL, CustConn
Then I loop through them one by one.
Do While Not CustRS.EOF
lblLeft.Caption = CStr(Val(lblLeft.Caption) + 1)
When I do, I always come up 1827 short in the count with a starting value of 29979. Any ideas why? The databases I am using while developing are static so there are no changes being made. They also have no one else using them so I don't think it is a locking problem. Just can't seem to figure this one out. I normally use DAO but was trying something new.
By barbarosa80503 in forum VB Classic
Last Post: 10-28-2005, 03:33 PM
By Liam Phillips in forum VB Classic
Last Post: 07-24-2002, 02:34 PM
By Filipo Novo Mór in forum VB Classic
Last Post: 06-19-2001, 08:40 AM
By Jeff Pipes Jeff in forum VB Classic
Last Post: 10-10-2000, 12:35 PM
By Kent Hendrix in forum VB Classic
Last Post: 06-12-2000, 03:52 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center