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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine Number of Rows returned in a Query 1

Status
Not open for further replies.

jmgibson

Technical User
Oct 1, 2002
81
US
Hi,

I suspect this is easy for many, but I can't figure out the necessary vba code to execute a requery and determine how many rows were returned in the query.

Here's the basic gist of what I'm doing. Do I need to declare anything to use the RecordCount feature?



Private Sub Form_Current()
If qryresults.RecordCount = 0 Then
Me.TabCtl4.Pages(3).Visible = False
Else
Me.TabCtl4.Pages(3).Visible = False
End If

End Sub
 
G'day,

As ever, there are many ways to skin a cat but one simple option could be:

Code:
dim intRecordCount as integer
intRecordCount=DCount("*","qryResults")

if intRecordCount>0
  Me.TabCtl4.Pages(3).Visible = True
Else
  Me.TabCtl4.Pages(3).Visible = False
end if

Good luck! JB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top