Insert record into Access

O

Otuatail

Sorry for my last posting I found this works
rsWeeks.Open sqlAddWeek, connection
but I have set an auto number ID in the table and marked it as a primary Key
But it insists that I add a value here. What do I do to omit this
from my query in Can I modify the Table.

Paul.
 
H

Hywel Jenkins

Sorry for my last posting I found this works
rsWeeks.Open sqlAddWeek, connection
but I have set an auto number ID in the table and marked it as a primary Key
But it insists that I add a value here. What do I do to omit this
from my query in Can I modify the Table.

There's no HTML to do this. If you had a two field access table
(userName):
ID (AutoNumber, Primary Key)
myName (255)
you should be able to do
INSERT IN TO userName (myName) VALUES ('Hywel')

The ODBC driver should sort the autonumber field for you, after all,
how can you be sure that you know the actual value you need? Unless
you did a MAX on that field, incremented the value returned and then
used that.
 
C

Clive Moss

Otuatail said:
Sorry for my last posting I found this works
rsWeeks.Open sqlAddWeek, connection
but I have set an auto number ID in the table and marked it as a primary Key
But it insists that I add a value here. What do I do to omit this
from my query in Can I modify the Table.

Paul.

For starters your sql statement should give the field names:

sqlAddWeek = "INSERT INTO Weeks Field1, Field2, Field3, Values('" & FullDay
& "'," & cint(sMonth) & ","
& SelWk & ")"

CM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top