Results 1 to 2 of 2

Thread: Insert * <> Colx

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    Colorado, USA
    Posts
    18

    Unhappy Insert * <> Colx

    Hello,

    Here is my challenge:

    I want to instert records from table 1 to table 2 using the following code: (Using Access Tables)

    db.Execute " Insert INTO [Table2] " _
    & "IN """ & OtherDB & """ Select [Table1].* FROM [Table1]"

    The problem is that the primary key in these tables is an autonumber field. Help says to exclude the autonumber field if I want it to issue a new number when I insert. How can I exclude the column w/out having to state "Select col1, col2, etc"?

    Is this possible?

    Any suggestions are greatly appreciated!

  2. #2
    Addicted Member Mandelbrot's Avatar
    Join Date
    Aug 2001
    Location
    Work, as usual!!
    Posts
    241
    Carrol,


    Firstly, no - you must use Col1, Col2 ... etc.

    Secondly, the only way you can actually "enter your own number" is to change the AutoNumber field to a standard (Long) Number field.

    You can increment an AutoNumber field, though, by inserting the number you want, minus 1, into the AutoNumber field (a bit messy!).


    Any help?

Posting Permissions

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



Click Here to Expand Forum to Full Width