Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002
    Posts
    121

    Red face Unanswered: Storing results of a query

    Is there some way to store the values returned by a SELECT statement into variables? In Oracle there's the SELECT...INTO for example,

    SELECT first_name
    INTO v_first
    FROM table;

    This stores the values returned for first_name and last_name into the variable v_first. However, in Access it appears that a table is created (v_first), not a variable. How can I get around this so that I can simply store the returned value in a variable instead of a table?

  2. #2
    Join Date
    Aug 2002
    Location
    Newport News, VA
    Posts
    8

    Talking

    The only way I know of doing this is to use a recordset.

    Sub TestThisJoint
    dim R1 as recordset
    set r1 = currentdb.openrecordset("tablename ")
    r1.movefirst
    do
    variable1 = r1.field1
    variable2 = r1.field2
    variable3 = r1.field3 & " " & r1.field4 & " " & ...
    .
    .
    .
    r1.movenext
    loop until r1.eof
    r1.close
    End Sub

    Hope this helps!

Posting Permissions

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