Hi guru's,
I m unable to find how to Insert a primary key which is also an autonumber field into Table. My query is as below.It is inserting record if i m hardcoding the ID Field. It is VBA Access - Insert into TableName(ID,LoginName,FirstName,LastName)
-
Values(AutoNumber??,'Sam','Sam','Don')
- Insert into TableName(ID,LoginName,FirstName,LastName)
-
Values(21,'Sam','Sam','Don')
plz help me ASAP.
Ram
2 23352
If I understand your question correctly, the answer is that you don't need/shouldn't try to insert the Primary Key. Access automatically inserts Autonumber fields when a new record is generated; nothing is required on your part.
Welcome to bytes!
Linq ;0)> NeoPa 32,556
Expert Mod 16PB
As Linq says, you need to omit the [ID] field from the list : - Insert into TableName(LoginName,FirstName,LastName)
-
Values('MurphyS','Sam','Murphy')
The [ID] field will be set up automatically as it is an AutoNumber field.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ben.werdmuller |
last post by:
Hi,
Is there an easy way in ASP/VBscript to grab an autonumber (primary
key) field just after an SQL insert? This is probably easy, but I'm
stuck ..
Cheers.
|
by: S. van Beek |
last post by:
Dear reader,
By append a new record to a table I always expect the next higher value in
the range of the autonumber field.
But sometimes if I have deleted same records from a table the...
|
by: marko |
last post by:
I would like my autonumber field to start at 100000. How can i do that?
|
by: HS1 |
last post by:
Hello
I have a table in Access Database. This table has a AutoNumber field. I use
a DataGrid to show that table
When I insert a new record in for this table using a DataGrid, there is a...
|
by: minjie |
last post by:
I need to upgrade a MS Access database (Version 2002) with a script
only, i.e., via SQL statement, not via Access GUI, and I'm having
trouble defining an AutoNumber field. I got an exception error...
|
by: Dave |
last post by:
I have a table with 3 fields of which the primary key is a autonumber. I have
created my dataadapter, dataset and datagridview using a wizard. However, in
the datagrid, the update and delete...
|
by: jmar |
last post by:
I'm hoping someone out there can give me a little guidance. I have
an Access Database "Customer.MDB" with a table "CustInfo" that
has the following design:
Field: DataType
CustID AutoNumber...
|
by: BMF |
last post by:
Howdy,
I am mainly a MySQL user but I have been playing with Access 07 a little bit recently. I created a database with 3 tables.
Table ID ---
userID -- AutoNumber
UserInfo -...
|
by: Mihail |
last post by:
Hello !
I have more related tables:
T_1, T_2 .... T_k, T_k+1 .... T_n
Every table has a primary key defined as AutoNumber.
For k = 2 to n every table has a field defined as LookUp on T_k-1...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
| |