Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2005
    Posts
    8

    Unanswered: VBA/SQL Count in a VBA Var

    Anyone know how to store a specific row of a specific field in a VBA var?

    I can point to an entire field but not just the one row with this i believe.

    myRecordSet.Fields(0).Value

    But how do I specify the row as well? Does this just make an array with each row?

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    I'm not sure I understand the question. Could you provide your practical context?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Quote Originally Posted by BlackHaloBender
    Anyone know how to store a specific row of a specific field in a VBA var?

    I can point to an entire field but not just the one row with this i believe.

    myRecordSet.Fields(0).Value

    But how do I specify the row as well? Does this just make an array with each row?
    Hi, BlackHaloBender,

    Why not do it the hard way?
    Code:
    Dim rst As Recordset
    
    Set rst=CurrentDb.OpenRecordset("SELECT YourTableField FROM YourTableName WHERE (you fill in the criteria here)", dbOpenDynaset)
    With rst
        (check first for presence of data to avoid a possible error message)
        .MoveFirst
        YourVBAVariableName = !YourTableField
        .Close
    End With
    You can put this code in the form's OnCurrent section.

    Hope this helps,

    Sam

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    If that's the question, DLookup() again...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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