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

How Do I tell my program that there r no records?

Status
Not open for further replies.

Chavito21

Programmer
Mar 26, 2003
230
0
0
US
Hi everyone,

I have an application where when I read each record and when I move the first record using :
rsTable1.MoveFirst
If there is nothing there Microsoft gives me a msg saying that is no records. How can I control this that when I moce the first record I could put and If statment saying if is no record do nothing and continue with the rest of the process.

Thanks
Chavito
 
if rsTable1.recordcount = 0 then
exit sub
else
rsTable1.moveFirst
blah
.
.
.
end if
 
aah that simple huh. GingerR you are my hero.
I am new at this.

Thanks
Chavito
 
Best to check for EOF, since some recordsets may not return a count.

If rs.EOF then
Msgbox "no records"
end if
 
I would improve on the last one by adding this:

If (rs.BOF AND rs.EOF) then
'Code for no records goes here
Else
....
End IF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top