Adding a record (1 Viewer)

cheberdy

Member
Local time
Today, 15:52
Joined
Mar 22, 2023
Messages
77
I have a form where I can create a new record in a table. I do this with a simple select. However, there is a problem. The primary key of the table is an auto value. How can I display the next higher primary key in the textbox for the primary key in the form. Otherwise there is always the error message "Record could not be set up because of key violation."
 

Ranman256

Well-known member
Local time
Today, 09:52
Joined
Apr 9, 2015
Messages
4,337
if its autonum, then there should be no problem. Just save the record and the new key is generated.
Its passive, nothing for anybody to do here.
 

plog

Banishment Pending
Local time
Today, 08:52
Joined
May 11, 2011
Messages
11,646
I have a form where I can create a new record in a table. I do this with a simple select.

Not to be pedantic, but a SELECT does not add a new record in a table. Further, the "next" autonumber doesn't exist, only ones that have been allocated to records. You can simply add 1 to the highest existing one, but that's not a 100% guarantee that it will be the next autonumber used.

Is your form bound to the table? If not, why not? If so, then it should take care of adding a record and displaying all the data in freshly created ones. Your description makes me think you are doing some non-standard stuff. Perhaps post a sample database so we can see what is actually happening
 

jdraw

Super Moderator
Staff member
Local time
Today, 09:52
Joined
Jan 23, 2006
Messages
15,379
Further to the info from others, can you provide an overview of your application? What exactly are you trying to do? There may be several options, but readers need a little more info in order to provide focused guidance.
 

cheberdy

Member
Local time
Today, 15:52
Joined
Mar 22, 2023
Messages
77
Further to the info from others, can you provide an overview of your application? What exactly are you trying to do? There may be several options, but readers need a little more info in order to provide focused guidance.
It is unfortunately in German, but Artikelnummer is the primary key and has the autovalue data type. It is the only bound value, but it does not show a number. How to change this?
 

Attachments

  • Internet.png
    Internet.png
    31.9 KB · Views: 54

Users who are viewing this thread

Top Bottom