DoCmd.CopyObject myDB, sNewQueryName,
acQuery, "qryGenericIDDates"
i have public declared myDB as Database and set it to
CurrentDB, sNewQueryName is a string containing the name
of the query I want created and qryGenericIDDates is the
existing query in the database
when running this line of code it always errors
with "2498 - an expression you entered is the wrong data
type for one of the arguments"?
could someone please tell me what I am doing wrong?
Jamie
The first parameter should be a string that's the valid path and file name
for the database you want to copy the object into. You can leave this
parameter blank if you are copying into the current database.
DoCmd.CopyObject , sNewQueryName, acQuery, "qryGenericIDDates"
or since the name property of the database object contains the full path and
file name of the mdb (if myDb is referring to a different database)
DoCmd.CopyObject myDB.name, sNewQueryName, acQuery, "qryGenericIDDates"
--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
QUOTE from online help
Destination Database - A string expression that's the valid path and file name
for the database you want to copy the object into. To select the current
database, leave this argument blank.
END QUOTE
So try:
DoCmd.CopyObject , sNewQueryName,acQuery,"qryGenericIDDates"
or
DoCmd.CopyObject myDb.Name, sNewQueryName,acQuery,"qryGenericIDDates"
>.
>