I need to add values to column in table in VBA Access. But column is number and lookup (from other table) and multiple value
I tried many commands:
Private Sub buttRec_Click()
Dim db As DAO.Database
strSQL = "INSERT INTO TABB (BNUM) VAULE (3)"
Set db = CurrentDb
db.Execute strSQL
Set db = Nothing
End Sub
options for strSQL which I tried:
strSQL = "INSERT INTO TABB (BNUM) VALUES (1), (2), (3);"
strSQL = "INSERT INTO TABB (BNUM) VALUES (1,2,3);"
strSQL = "INSERT INTO TABB (BNUM) VALUES ('1,2,3');"
strSQL = "INSERT INTO TABB (BNUM) VALUES (1;2;3);"
strSQL = "INSERT INTO TABB (BNUM) VALUES ('1;2;3');"
strSQL = "INSERT INTO TABB (BNUM) SELECT '1' UNION SELECT '3'"
strSQL = "INSERT INTO TABB (BNUM) SELECT 1 UNION SELECT 3"
How to do this?
Thanks for help.
Some examples for MultiValue fields.
INSERT and DELETE
Test data:
table
TABBwith columnsId- primary key,RowName- text,BNUM- multivalued field.Insert row to table
Insert new value to multivalued field
Insert second value to multivalued field
Insert next value to multivalued field
Values in BNUM mast be unique.
Insert from subquery
Multiple value fields operations thru Recordset.
Examples for Add and Delete operations