Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    insert into from multiply tables problam

    insert into from multiply tables problem

    Hello folks
    im trying to insert to table foo (filed_1 , filed_2 )
    from 2 different table something like that :

    INSERT INTO foo (Myname ,Sname) values ((SELECT id FROM foo1 WHERE TheName='dodo' ) , (SELECT id FROM foo2 WHERE TheName='dsdsdsdsd' )(

    but i keep getting error msg "reserved error (-3025)"

    if i run each sub queries it works
    but i try to combine them to one it don't

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could do each select then the insert:

    Code:
    Set Recordset = Conn.Execute(SELECT id FROM foo1 WHERE TheName='dodo')
    sfoo1 = Recordset(0)
    
    
    Set Recordset = Conn.Execute(SELECT id FROM foo2 WHERE TheName='dsdsdsdsd')
    sfoo2 = Recordset(0)
    
    Conn.Execute(INSERT INTO foo (Myname ,Sname) values sfoo1, sfoo2)
    USA

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello tnx for the fast reply
    yeah i know that ..
    but im looking to know if i can do it in one sql Statement
    or if access support it even..
    tnx


  •  

    Posting Permissions

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