L
Laurel
I need help in handling situations when there are no rows in a record set.
When the following script returns rows, li_count has a value of 1, no
matter how many are actually returned. I know I can deal with that by doing
a .movelast .movefirst before getting the value of recordcount. But if
there happen to be no rows returned, then the .Move* code produces a "no
current record" error. Feels like a catch 22... This seems like such a
common situation. There must be a simple technique?
ls_temp = "Select * from tblStudents Where class_code = '" & cboClass_Code
& "'"
Set rstClassList = CurrentDb.OpenRecordset(ls_temp)
li_count = rstClassList.RecordCount
When the following script returns rows, li_count has a value of 1, no
matter how many are actually returned. I know I can deal with that by doing
a .movelast .movefirst before getting the value of recordcount. But if
there happen to be no rows returned, then the .Move* code produces a "no
current record" error. Feels like a catch 22... This seems like such a
common situation. There must be a simple technique?
ls_temp = "Select * from tblStudents Where class_code = '" & cboClass_Code
& "'"
Set rstClassList = CurrentDb.OpenRecordset(ls_temp)
li_count = rstClassList.RecordCount