How to split the code in VBA

Kiranpendy

Registered User.
Local time
Yesterday, 23:31
Joined
Sep 3, 2019
Messages
15
I have the following code that i need to write in vb after button click but i'm not able to write it because it is too big. I know that you could use "_" or "& _" for strings. But these are fields columns in the table and i'm pretty new to MS Access. Any help is appreciated.

The Sample code:
Code:
CurrentDb.Execute "INSERT INTO Table1( Field 1,Field 2, [Field 3],[Field 4], ....
....
.,Field 40]) 
SELECT Tabel2.Field1, Tabel2.Field2, Tabel2.[Field3],..., 
..,
..,Table2.[Field 40]
FROM Table2"
 
Last edited by a moderator:
Hi. Welcome to AWF!


You should still be able to use the continuation characters for SQL statements. For example:
Code:
strSQL = "INSERT INTO TableName(Field1, " _
    & " Field2, " _
    & " Field3, " _
    & and so on...
 
Thank you! it worked fine.
 

Users who are viewing this thread

Back
Top Bottom