J
javaguy
In my Access application I'm fetching data thru SQL statements, and
not directly thru a RecordSet object. In my statements, such as
select count(*) as reccount from [Survey Info] where [Last Name] =
"Smith"
things work OK. The returned count is 1.
But if my statement is
select count(*) as reccount from [Survey Info] where [Last Name]
like "Smit*"
then I get back a reccount value, but the count is 0.
If I copy this SQL and use it in a query builder, the SQL performs
properly. It doesn't perform OK in my code.
Here is the context:
....
Dim conn As ADODB.Connection
Set conn = CurrentProject.Connection
Dim sql As String
sql = "select count(*) as reccount from [Survey Info] where [Last
Name] like "Smit*"
Dim recSet As New ADODB.Recordset
recSet.Open sql, conn, adOpenStatic
If recSet.RecordCount <> 0 Then
Dim filterCount As Long
filterCount = recSet.Fields("reccount").value
End If
....
I've searched groups and other web pages, and the help files, but
don't see any mention of a performance difference or error in Access.
It works the same (badly) on Windows XP and Vista. Again, I'm using
Access 2003 with a MDB file.
Thanks in advance,
Jerome
not directly thru a RecordSet object. In my statements, such as
select count(*) as reccount from [Survey Info] where [Last Name] =
"Smith"
things work OK. The returned count is 1.
But if my statement is
select count(*) as reccount from [Survey Info] where [Last Name]
like "Smit*"
then I get back a reccount value, but the count is 0.
If I copy this SQL and use it in a query builder, the SQL performs
properly. It doesn't perform OK in my code.
Here is the context:
....
Dim conn As ADODB.Connection
Set conn = CurrentProject.Connection
Dim sql As String
sql = "select count(*) as reccount from [Survey Info] where [Last
Name] like "Smit*"
Dim recSet As New ADODB.Recordset
recSet.Open sql, conn, adOpenStatic
If recSet.RecordCount <> 0 Then
Dim filterCount As Long
filterCount = recSet.Fields("reccount").value
End If
....
I've searched groups and other web pages, and the help files, but
don't see any mention of a performance difference or error in Access.
It works the same (badly) on Windows XP and Vista. Again, I'm using
Access 2003 with a MDB file.
Thanks in advance,
Jerome