Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RECORDCOUNT WHEN USING Me.RecordSource = sqlline

Status
Not open for further replies.

fsweb2002

Programmer
Apr 11, 2002
94
TR
Hi
I have a continuous form which displays records matching a query.
The query is created and run using

Me.RecordSource = sqlline ' sqlline being the SQL query

I now need to use the recordcount property to find out how many records have been selected by the query.

I don´t know how to do this !

Your help is appreciated

 
Hi!

Open it as a recordset, like this:

Dim rst As DAO.Recordset

Set rst = CurrentDb.OpenRecordset(sqlline, dbOpendynaset)

If rst.EOF = True and rst.BOF = True Then
Call MsgBox("No Records")
Else
rst.MoveLast
rst.MoveFirst
rst.RecordCount is the number of records and you can store it anywhere you want
End If

Set rst = Nothing

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top