Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2005
    Posts
    113

    Unanswered: Problems with recordset

    Hi, I try to catch when the recordset is empty - It works fine when my sql question have a name but when its empty I get error 3265

    Code:
    strSQL = "SELECT tblSteg.Name, tblSteg.Month FROM tblSteg " _
     	& "WHERE (((tblSteg.Name) Like '" & Me.cboName & "') AND((tblSteg.Month) Like '" & Me.cboMonth & "'));"
    
    Set rst = dbs.OpenRecordset(strSQL, DB_OPEN_DYNASET)
    
    If IsNull(rst!Namn) = True Then --------------- I want to catch the error here
       do something
    else
       something else
    end if

  2. #2
    Join Date
    Nov 2005
    Posts
    113
    Ups - I have it

    if rst.recordCount = 0 ---Then no record is found

    Thanks J

  3. #3
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,418
    Provided Answers: 7
    or if rst.eof then eof = End Of File
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  4. #4
    Join Date
    Nov 2005
    Posts
    113
    Thank you, seems like I learn more and more every day!

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    I thought to check for an empty recordset you checked both the eof & bof properties.

    recordcount is only populated if you move to the last record if I rememebr correctly
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by healdem
    recordcount is only populated if you move to the last record if I rememebr correctly
    Yes, I believe you are correct... If we wern't dealing with Access.
    George
    Home | Blog

Posting Permissions

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