Results 1 to 3 of 3

Thread: Empty recordset

  1. #1
    Join Date
    Aug 2004
    Posts
    19

    Unanswered: Empty recordset

    Hi

    When using the OpenRecordset, how can i check if the result is empty?

    I need to calculate some fileds, but if the recordset is empty i've got an error when using the movefirst command.

    ie:

    dim strSQL as string
    Dim dbVisitacao as database
    Dim rstVisitacao as recordset

    strSQL = "SELECT * FROM [Visitação] WHERE " & FiltroListagem
    '(FiltroListagem is a Global variable not defined here)

    Set dbVisitacao = CurrentDb
    Set rstVisitacao = dbVisitacao.OpenRecordset(strSQL)

    rstVisitacao.movefirst
    'IF THE RESULT IS EMPTY THEN I'VE GOT THE ACCESS MESSAGE AND THE ROUTINE IS ENDED

    ...

    Please Help

  2. #2
    Join Date
    Sep 2003
    Posts
    228
    if not rs.eof and not rs.bof then
    'not an empty recordset
    endif

  3. #3
    Join Date
    Aug 2004
    Posts
    19

    Talking

    Thanx1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •