Counting records returned by SQL Select statement 
Author Message
 Counting records returned by SQL Select statement

Hi,

How do I go about counting the number of records to be
returned by my code:

strSQl= "SELECT * FROM myTbl WHERE myDesc LIKE '" &
strmyTextbox & "' & '*'"

before either using

me.RecordSource = strSQL

or before requerying the form based on the results of the
above line?

TonyT



Fri, 26 Aug 2005 21:17:55 GMT  
 Counting records returned by SQL Select statement
I guess you could use the DCount function.

SomeVariable = DCOUNT("*","MyTbl","MyDesc Like '" & strMyTextbox & "*'")

Quote:

> Hi,

> How do I go about counting the number of records to be
> returned by my code:

> strSQl= "SELECT * FROM myTbl WHERE myDesc LIKE '" &
> strmyTextbox & "' & '*'"

> before either using

> me.RecordSource = strSQL

> or before requerying the form based on the results of the
> above line?

> TonyT



Fri, 26 Aug 2005 23:25:27 GMT  
 Counting records returned by SQL Select statement
Yet again I miss the obvious :)

thanx,

TonyT

Quote:
>-----Original Message-----
>I guess you could use the DCount function.

>SomeVariable = DCOUNT("*","MyTbl","MyDesc Like '" &

strMyTextbox & "*'")
Quote:


>> Hi,

>> How do I go about counting the number of records to be
>> returned by my code:

>> strSQl= "SELECT * FROM myTbl WHERE myDesc LIKE '" &
>> strmyTextbox & "' & '*'"

>> before either using

>> me.RecordSource = strSQL

>> or before requerying the form based on the results of
the
>> above line?

>> TonyT
>.



Sat, 27 Aug 2005 00:03:24 GMT  
 Counting records returned by SQL Select statement


Quote:

> Yet again I miss the obvious :)

The alternative is to recast the query slightly:

  strSQl= "SELECT COUNT(*) FROM myTbl " & _
          "WHERE myDesc LIKE '" & strmyTextbox & "' & '*'"

hth

Tim F



Sat, 27 Aug 2005 04:19:28 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Counting Records in VB w/SQL statements

2. SELECT Statement returns no records....

3. running sql code record by record instead of statement by statement

4. SQL Statement does not return records

5. SQL Statement returns records in Access but not in ADO

6. Locking a record with a SELECT SQL statement

7. PROBLEM: SELECT @@Identity return DBNull when insert new record (VisualBasic Dot Net, SQL 2000)

8. SQL select returning EOF when record exists

9. How to select the current record only with SELECT statement

10. Combo click event returns 1st record not selected record

11. SQL query: from SELECT statement to stored procedure with dynamic PL/SQL

12. ADO SQL Search That Returns 0 Records When it Should Return 1

 

 
Powered by phpBB® Forum Software