Using INSERT INTO and setting a single field value - Access VBA

I use INSERT INTO to copy rows of data from one table to another:

INSERT INTO tblNewCustomers (CustomerID, [Last Name], [First Name]) SELECT CustomerID, [Last Name], [First Name] FROM tblOldCustomers 

How to set one of the field values ​​in tblNewCustomers for all new records that I import using this operator, for example,

 tblNewCustomers.existCustomer = TRUE 

Thank you in advance for your help.

Noel

+4
source share
2 answers
 INSERT INTO tblNewCustomers (CustomerID, [Last Name], [First Name], [existCustomer]) SELECT CustomerID, [Last Name], [First Name], True FROM tblOldCustomers 
+7
source

You can also ignore the field in the SQL statement and make it default to true. BUT I think the Smandoli solution is more accurate

0
source

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


All Articles