View Full Version : No data entries than fail?

02-03-2005, 06:08 AM

when you are using a SQL statement and getting records from a database,
you use 'If NOT objRS.EOF Then'
and because it is an 'if ... then' statement, you put an 'else' there and give it something to do if there are no records.

how do you do this when there isn't an 'if... then' statement like
'Do While Not objRS.EOF'



02-03-2005, 08:20 AM
Check this links
If then, else (http://www.w3schools.com/vbscript/vbscript_conditionals.asp)
Do While, loop (http://www.w3schools.com/vbscript/vbscript_looping.asp)

02-03-2005, 09:51 AM
you could do something like an integer that increases when the loop is run, if after the "loop" line its still 0, there were no records, however i would just do

If NOT objRs.EOF Then
Do While NOT objRs.EOF
'there were no records
End Ifalso, you dont NEED an else, and it will work without the if statement at all, this is only for if you want to get any records.. you could also check for BOF to see if the recordset exists i spose *shrugs* ive never used BOF, i dont really know what its there for :p

02-03-2005, 10:23 AM
That works great - thanks.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum