How to create a parameter in an APPEND SQL statement to get the database location?

Hi Experts,

I have a fairly straightforward append sql statement within MS-Access 2003 (having used its SQL visual designer) in the form of:

INSERT INTO [tableA] ( field1, field2, ..., ...) IN 'C:\TicketMan\DATABASE\Events Storage\events.mdb'
SELECT ( field1, field2, ..., ...) FROM [tableX];

Instead of having the database file path/name hardcoded within the SQL, how do I create a parameter for it?

Thanks!
TicketManAsked:
Who is Participating?
 
Jorge PaulinoConnect With a Mentor IT Pro/DeveloperCommented:
Why don't you replace the path with a variable?

Dim var As String  = "C:\TicketMan\DATABASE\Events Storage\events.mdb"
Dim SQL As String =  "INSERT INTO [tableA] ( field1, field2, ..., ...) IN '" & var & "'"
0
 
TicketManAuthor Commented:
Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.