"Item not found", but I know it's there - I can see it!

M

Margaret Bartley

I'm using VBA to create a query, run it, open it, get a count of records,
and then enter that record count into the Description property of the query.
It works fine, except that occassionally I will get an error,
"Item not found in this collection"
when I try to create the property.

When I go into debug mode, I can go to the list of queries, and open the
query. It exists. I've checked the name, the name is the same. I've
created the query, but my procedure can't find it.

When I go into the Locals window, and look at the Tables documents, that
query will not be listed. I've noticed that there are some tables with
names that start "~TMPCL....." with Create times about when my query would
have been created.

I thought maybe the code was too fast, but I've stopped the code, opened the
query, closed it, and it still doesn't show up.

when I go to the Command window, and type in
? db.containers("Tables").Documents("ABC").Properties.Count
I get the same error, "Item not found in this collection"



Clearly, what is happening is that there are two names for these queries,
one that shows up in the User Interface, the other a system name, and they
are getting confused.

Has anyone seen this? Any solution?
Most of the time it works, but sometimes it doesn't.
I've tried compact and repair, that doesnt' help, either.
 
T

tina

if you're using A2000 or newer, is Name AutoCorrect turned OFF in your db?
if not, suggest you turn it off (a good idea even if it doesn't fix your
problem). if it has no effect, you might try this before giving up the idea:

create a new blank db
immediately turn off Name AutoCorrect (Tools | Options | General tab)
import the objects from your other database
compact the new db

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top