Results 1 to 3 of 3

Thread: Select...into

  1. #1
    Join Date
    Aug 2002
    Posts
    121

    Cool Unanswered: Select...into

    Can you SELECT...INTO more than one variable? I'm doing the following...

    docmd.RUNSQL "SELECT table1.last_name, table1.first_name
    INTO v_surname, v_first
    FROM table1
    WHERE table1.id = txtID.value;"

    The above statement it throws an error. However, when I use just one variable in the SELECT INTO statement, it runs fine.

    Any thoughts???

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    "select into" creates a table, not a variable

    you musta got only one row of one column to make you think that :-)

    table1
    a b c
    1 x 3
    2 y 6
    4 z 9

    select a, c
    into table2
    from table1

    the above will create

    table2
    a c
    1 3
    2 6
    4 9


    rudy
    http://rudy.ca/

  3. #3
    Join Date
    Aug 2002
    Posts
    121
    Ooops. So what is my alternative? I need to look up certain values in tables and place them into variables. If I can't do this with a SELECT INTO then what do you suggest? Unlike Access, in PL/SQL when you use SELECT...INTO, you are actually placing the the returned values into variables, not tables. So, how can I get this functionality in Access?



    Originally posted by r937
    "select into" creates a table, not a variable

    you musta got only one row of one column to make you think that :-)

    table1
    a b c
    1 x 3
    2 y 6
    4 z 9

    select a, c
    into table2
    from table1

    the above will create

    table2
    a c
    1 3
    2 6
    4 9


    rudy
    http://rudy.ca/

Posting Permissions

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