ACCESS / VBA: Paste in the autonumbering field returns an annoying warning

Well, here's the situation.
Let table 1 (A, B, C)
A be the field for automatic filling.

I feed the table through vba.
Since A is auto-numbered, I ignore it like this:

SQL = INSERT INTO TABLE1(B,C) VALUES ('something','something else')
DoCmd.RunSQL SQL

This works fine, access gives me the first warning that I will create a new line.
This is normal for me. However, right after that I get the following:

Microsoft Access cannot add all entries to the update or add request.
It sets 1 field to Null due to type conversion failure.
 blahblahblah click "OK" to complete the request anyway

This does not prevent it from working if I click OK, but I do not want my user to see this warning.
And anyway, why does it pop up? Isn’t it normal for an empty auto-complete field to be empty?
Is there any other procedure that I do not know about? What am I missing?

I looked at Google here too, but could not find the answer: /

(I do not want setwarnings to false, since I want the first warning about adding a field and any other possible error to be visible.)

+3
source share
3 answers

Microsoft Access cannot add all entries to the update or add request. It sets 1 field to Null due to type conversion failure.

autonumber. B C.

C , , , INSERT , Null C:

DoCmd.RunSQL "INSERT INTO TABLE1(B,C) VALUES ('something','something else')"

C .

DoCmd.RunSQL "INSERT INTO TABLE1(B,C) VALUES ('something',99)"

. , C. , - , :

DoCmd.RunSQL "INSERT INTO TABLE1(B,C) VALUES ('something','27')"
+6

- autonumbering? ( , "run anyway" ), ?

Autonumber; , .

+2

, NULL.

Are all fields filled in correctly? Including Autonumber?

+2
source

Source: https://habr.com/ru/post/1792252/


All Articles