Results 1 to 2 of 2

Thread: First record of a query...

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    12

    Question

    Hi,
    i would like to extract the first record of a data base (in Oracle, or access or sql server) with a query in visual baic 6, but i don't want use counter or similar. How can i do?
    thanks in advance

  2. #2
    Lively Member
    Join Date
    May 2000
    Location
    Antrim
    Posts
    80
    Try this:

    Dim dbsDatabase as Database
    Dim rstRecordset as Recordset

    Set dbsDatabase = OpenDatabase "Full Path Here", False
    Set rstRecordset = "Select Query Here"

    rstRecordset.MoveFirst

    That should place you in the first record of your recordset.

    If you want to extract individual fields then just use something like this:

    Dim strField0 as string

    strField0 = rstRecordset(0)

    0 is the first column in the recordset, if you want other columns then just substitute 0 for 1 and so on.

    Hope this helps.

    Best regards,

    Rob Brown.

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