T
Tommy Hayes
Hello all,
I have the following code snippet in my Access app:
Dim dbQueryDef As QueryDef
Set dbQueryDef = CurrentDb.QueryDefs("QUERY_NAME") ' (1)
Set dbQueryDef = CurrentDb.QueryDefs(26) ' (2)
Line (1) does not do as I expect it - it always returns the first
QueryDef in the QueryDefs collection (seen by examining the QueryDefs
object at debug time).
However if I pass the ordinal of the correct QueryDef as in line (2)
above then it works fine.
Anyone know what is going on? Is the string in (1) above being
converted into 1 before being passed to the Item(Item) method of the
collections? I'm a VBA newbie so please excuse the innocence of this
question.
Thanks,
Tommy.
PS: It's an Access 2000 file being run from within Access 2003 if
that's a factor. I need to keep it in 2000 format for the client.
I have the following code snippet in my Access app:
Dim dbQueryDef As QueryDef
Set dbQueryDef = CurrentDb.QueryDefs("QUERY_NAME") ' (1)
Set dbQueryDef = CurrentDb.QueryDefs(26) ' (2)
Line (1) does not do as I expect it - it always returns the first
QueryDef in the QueryDefs collection (seen by examining the QueryDefs
object at debug time).
However if I pass the ordinal of the correct QueryDef as in line (2)
above then it works fine.
Anyone know what is going on? Is the string in (1) above being
converted into 1 before being passed to the Item(Item) method of the
collections? I'm a VBA newbie so please excuse the innocence of this
question.
Thanks,
Tommy.
PS: It's an Access 2000 file being run from within Access 2003 if
that's a factor. I need to keep it in 2000 format for the client.