Parameter for Database in a make table querie

  • Thread starter Thread starter BD
  • Start date Start date
B

BD

It's possible to use a parameter at IN clause that take the name of a
database in a make table query that can be reused in the same front
end for different back end databases? Like this:

INSERT INTO table
IN Param ...

In code:

dim db as database
dim qdf as querydef

set db=currentdb
set qdf=db.querydefs("qryname")
qdf("Param")="c:\mydatabase"
db.execute dbfailonerror

I have a error that can't use database type. How can I resolve this?


[]'s
BD
 
I doubt you can use a parameter like that.

But it's dead easy to build the string in your code. In the following
example, strcStub is the entire SQL statement up to and including the IN,
and strcTail is the rest of the SQL statement after the file name:

Dim strFileName As String
Dim strSql As String
Const strcStub = "INSERT INTO ...
Const strcTail = " WHERE ...

strFileName = "C:\MyFolder\MyFile.mdb"

strsql = strcStub & strFileName & strcTail
Debug.Print strSql
db.Execute strSql, dbFailOnError
 
Back
Top