INSERT INTO and autonum, and Access-specific SQL reference/book

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All.
Two questions:
1. When using INSERT INTO a (linked) table with an autonum column I
sometimes get no data inserted (although the next ID is apparently used), and
no error. If I remove the autonum it works? Is there any special syntax, or
an execute/commit required?
2. Does anyone know of an advanced, Access-specific SQL book/reference
material?
thank you
 
Some thoughts on your first question:

I assume you are inserting the values for the fields in the table and not
attempting to add the auto-number field.

I've found that as long as you add a value to all fields except for the
autonumber and the value of any of those fields doesn't violate constraints,
the insert will work correctly.

I had a similar experience where the data didn't insert into the table where
I received no error message and when I checked, the autonumber had been
incremented but no data had been inserted. I was able to find that some of
the data I was adding violated my index constraints; i.e. I had a table
column indexed and wasn't allowing duplicates. Maybe this or something
similar is affecting you?
 
Back
Top