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

    Unanswered: Storing Query Result in a VBA Var

    I have a query with only one field, one result that I want to stare in a VBA var.

    It seems like this should be a piece of cake right?

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Sounds like DLookup() might be in order...
    oh yeah... documentation... I have heard of that.

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

  3. #3
    Join Date
    Feb 2006
    Posts
    56
    you can do it quite easily from vba.

    dim strSQL,text_var as string
    dim db as database, rs as recordset

    strSQL = " Select * from Table1;"
    set db = currentdb()
    set rs = db.OpenRecordSet(strSQL)
    rs.movefirst

    do until rs.eof
    text_var = rs!field1

    'execute whatever code you want here.
    '
    '
    rs.movenext
    loop

Posting Permissions

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