Results 1 to 8 of 8

Thread: Simple ADO

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Location
    London, UK
    Posts
    137

    Lightbulb

    Sorry for this one, Some of you may laugh some of you may think what a Pratt.........But here it goes.

    What commands (code) would I use to check if a recordset contains information. Don't need to know what it contains just if it contains something??

    Thanks in advance

    Regards,

    Rocks
    join me in the platinum

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Check EOF on the recordset just after you open it. Just to be safe you could check for BOF AND EOF to both be true.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  3. #3
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    rst.recordcount=0

    Means no returned records
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Location
    London, UK
    Posts
    137

    Let me re phrase

    Thanks for your reply but after reading my own msg again, I would like to re-phrase it.

    I have a recordset that is populated with various records from a DB.

    It populates them one record at a time. What I would like to do is to check if a particular record is in the recordset just after the code to populate that recordset has been exe'd.

    This is because I write each record to an individual file, what I do at the moment is create all the files before the SQL has run. Therefore that results in empty files if no info is contained in some records.
    join me in the platinum

  5. #5
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    Be careful with RecordCount - it is not defined properly until all records have been traversed (rst.MoveLast or similar).

    If rst.EOF and rst.BOF Then
    MsgBox "Definitely no records"
    Else
    MsgBox "At least one record"
    End If

    Paul.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  6. #6
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    ??

    Will the all fields that are coming in have values? What I mean is, could you use a field to evaluate your situation?
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  7. #7
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    400
    Assuming you have a primary key, do a .Find (ADO) or .FindFirst (DAO) to find the value of the record you think you just added.

    Better would be to set the .Index property of the recordset to "PrimaryKey" and use the .Seek method, cause it's much faster.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Location
    London, UK
    Posts
    137

    Thanks

    Thanks all,

    Maybe you would be able to help me out with another Q.

    It is regarding Excel.

    I need to lock the margins of the workbook so that they can not be changed in the print preview or page setup....

    Thanks all.
    join me in the platinum

Posting Permissions

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



Click Here to Expand Forum to Full Width