empty recordset

  • Thread starter Thread starter Jean-Paul De Winter
  • Start date Start date
J

Jean-Paul De Winter

I made a recordset based upon some criteria

Following recordset is empty, so I created an "on error statement" so the
program doesn't stop. Alas this doesn't seem to work as I hoped


SQL_vak = "SELECT lessenrooster_lln.vak FROM lessenrooster_lln WHERE
lessenrooster_lln.uur='12' AND lessenrooster_lln.klas='" &
Forms!lessenrooster_lln!klas & "' AND lessenrooster_lln.jaar='" &
Forms!lessenrooster_lln!jaar & "' ;"

Set TB_Vak = db.OpenRecordset(SQL_vak)

On Error GoTo aanvullen4

Me!vak12.Value = TB_Vak!vak

GoTo verder4

aanvullen4:

Me!vak12.Value = Empty

verder4:

What am I doing wrong, there must be a better way I think
Thanks
JP
 
Jean-Paul De Winter said:
I made a recordset based upon some criteria

Following recordset is empty, so I created an "on error statement" so the
program doesn't stop. Alas this doesn't seem to work as I hoped


SQL_vak = "SELECT lessenrooster_lln.vak FROM lessenrooster_lln WHERE
lessenrooster_lln.uur='12' AND lessenrooster_lln.klas='" &
Forms!lessenrooster_lln!klas & "' AND lessenrooster_lln.jaar='" &
Forms!lessenrooster_lln!jaar & "' ;"

Set TB_Vak = db.OpenRecordset(SQL_vak)

On Error GoTo aanvullen4


You can check for an empty recordset through its RecordCount
property:

If TB_Vak.RecordCount > 0 Then
 
Back
Top