Solved

Insert from ASP to access (auto-increment field)

Posted on 2006-06-13
3
324 Views
Last Modified: 2012-08-13
Hello,

I would like to be able to insert a record, from ASP into an MS access database.
I have sucessfully created the database connection, and am able to pull records by doing SELECT statements, however I am running into a roadblock when i get to inserting because
one of the columns is an auto-incrementing field type in the database. What's the proper syntax to insert a line while leaving the field to be auto-incremented (it cannot be null, so I must send something in that column field). Something short of cycling through the table till the last entry and adding +1 to the last column value. Is there a specific syntax for this field type to trigger the auto-increment on the back end in the database?
0
Comment
Question by:system
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 125 total points
ID: 16897294
If the field is set up as an autonumbering field, you shouldn't need to pass anything in to access for that field.  This syntax works for me using asp.net/sql server.  I would think that It should work with an access back-end as well:

 strInsert = "INSERT INTO tblPersonnel (Field2,Field3,Field4) Values('" & me.txtField2.text & "','" & me.txtField3.text & "','" & me.txtField4.text & "')"

(Field1, an autonumbering field is left out completely but automatically increments when the rest of the line is inserted)
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now