Property not found error while DoCmd.OpenQuery

  • Thread starter Thread starter Ilya
  • Start date Start date
I

Ilya

Hi, all!

Some error drives me nuts...
I have some code which gathers query names to run to the collection of
strings. Then I just run through the collection and use the
DoCmd.OpenQuery CStr(MyCollection(i)) where i is just an index of the
string within the collection. When I do this I get an error number
3270 "Property not found".

When I break the execution and add the Resume command to get back to
the line that was executed last the execution proceeds without an
error.

I actually want this procedure to run without errors without stopping
or debugging it but it seems to preform without an error only if I set
a breakpoint or break the execution when this error occurs.

Does anybody has any clue for this?
Any help highly appreciated!!

Thanks in advance,
Ilya
 
Check to make sure that i <> 0. Collection indexes start at 1. If the
index is wrong, that error will be returned 'cuz there is no property at
index 0.
 
Check to make sure that i <> 0. Collection indexes start at 1. If the
index is wrong, that error will be returned 'cuz there is no property at
index 0.

Hi,

Actually here is the code for running through the collection:
For i = 1 To MyCollection.Count
DoCmd.OpenQuery CStr(MyCollection(i)), , acReadOnly
Next

So there is no 0 occurrence.

Ilya
 
Hi,

Actually here is the code for running through the collection:
For i = 1 To MyCollection.Count
DoCmd.OpenQueryCStr(MyCollection(i)), , acReadOnly
Next

So there is no 0 occurrence.

Ilya

Hi all,

Found solution myself.
The query should be defined with Returns Records property to false or
No, because the queries I've run were pass-through queries to change
the definition of tables. So one way is to change this property. The
other way is to get the SQL property of the query and set it to some
prepared query with this parametet of Returns Records set to No.

Good luck,
Ilya
 
Back
Top