Re: Use Function in Query problem
- From: Dale Fye <dale.fye@xxxxxxxxxx>
- Date: Thu, 21 Feb 2008 06:39:02 -0800
Stefan,
1. I'm assuming there is a typo in the QueryVar function, because the
return value is QueryVal, not QueryVar.
2. Not sure why you even need the function if all you are doing is passing
it a path and returning the same value.
3. The IN clause requires that the file name be wrapped in single or double
quotes. So it should read something like:
Dim SQL as string
SQL = "INSERT INTO ArchiveTable (Field1, .....) " _
& "IN '" & QueryVar([FieldName]) & "' " _
& "SELECT ..... FROM ArchiveTmp"
currentdb.execute SQL
HTH
Dale
--
Don''t forget to rate the post if it was helpful!
email address is invalid
Please reply to newsgroup only.
"Stefan Hoffmann" wrote:
hi Marco,.
Co wrote:
Now I run a query saying:You cannot use a expression after IN, there must be a constant.
INSERT INTO ArchiveTable ........ IN QueryVar SELECT ........ FROM
ArchiveTmp;
I'm getting an error saying he can't find the path.
What am I doing wrong here?
I assume you have a saved query, let's call it qryArchive. Then you can
do this:
Dim db As DAO.Database
Dim SQL As String
SQL = "INSERT INTO ArchiveTable ........ " & _
"IN " & QueryVarOrPathVariable & " " & _
"SELECT ........ FROM ArchiveTmp;"
Set db = CurrentDb
db.QueryDefs.Item("qryArchive").SQL = SQL
Set db = Nothing
mfG
--> stefan <--
- References:
- Use Function in Query problem
- From: Co
- Re: Use Function in Query problem
- From: Stefan Hoffmann
- Use Function in Query problem
- Prev by Date: Re: running sum in a query for a calculated field
- Next by Date: Re: Counting Nulls
- Previous by thread: Re: Use Function in Query problem
- Next by thread: Re: Use Function in Query problem
- Index(es):