Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178

    Cool Unanswered: isnull problems with recordset

    i have created a recordset called rs.
    rs has been set.
    now I want to check if rs!firstname has anything in it, so I did the following:

    dim rs as DAO.Recordset
    set rs = currentdb.openrecordset("select * from tbl_Employees")

    while not rs.EOF
    if isnull(rs!firstname) or rs!firstname = "" then
    msgbox = "yes"
    else
    msgbox = "no"
    endif
    rs.movenext
    wend

    there are plenty of null values in the firstname field, but it never sets msgbox to "yes"

    any suggestions?
    thanks in advance ActionAnt

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    And where is the problem? Did you get an error message ? And where, if ja

  3. #3
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178
    no error message.
    msgbox just never displays "yes"

    could it be the loop that I'm using
    for x = 1 to rs.recordcount
    ///////
    rs.movenext
    next x

    instead of
    while not rs.EOF
    ////////
    rs.movenext
    wend

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Before the While not rs.EOF

    write

    rs.MoveLast : rs.MoveFirst

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Also before executing the rs.MoveLast you have to check for the rs.RecordCount if it is greater than 0 then execute the rs.MoveLast. Otherwise you will get an error message

  6. #6
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178
    still nothing
    rs is set right before the loop starts

  7. #7
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178
    hold on
    I found something else that was not grafting properly.
    there isn't an error with the loop or isnull.

    thanks for all your help

Posting Permissions

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