Thank you for your answer.
Sorry for being so dense but I still seem to get unexpected odd
results. I have renamed the table to xAtable in the database.
Now I run the following commands. I think each answer is wrong.
y = fTableExists1("Atable") 'remember Atable does not exist now
debug.Print y
True
debug.Print y = fTableExists1("Atable")
True
debug.Print fTableExists1("xAtable") 'xAtable DOES EXIST
False
The bottom line is the answers seem to be all over the map and Im
confused by it.
> y = fTableExists1("Atable") 'remember Atable does not exist now
> debug.Print y
> True
The above tells me that "atable" does exists. Do a compact and repair Exit
the database...re-enter.
the above session tells me that "Atable" does exist.
if you go in the immediate window:
> y = fTableExists1("Atable") 'remember Atable does not exist now
> debug.Print y
> True
The above means that atable exists. You just mistaken that "atable" is not
there...it is. Perhaps the table is hidden or something, but I would suggest
you test this again, and use a different name...eg: table1
also, does all of the code in the application compile??? You need to do a
debug->compile and make sure all code is compiled.
> debug.Print y = fTableExists1("Atable")
> True
careful with the above. Assuming Atable does not exists, then we get
y = fTableExists1("Atable")
debug.print y = fTableExists1("table1")
true
You will ALWAYS get true for the above. Lets assume that table100 does NOT
exist. we go:
y = fTableExists1("table100")
tthe above beomes
y = false
at his point, now "y" has a value of false
We then go
debug.print y = fTableExists1("table100")
the above becomes
debug.print false = false
and, the result printed is true. If you execute any other code in the
immediate window that causes a exectuion error, then ALL varaibles are
re-set.
Check your results again.
Try typing in the following in the debug window:
debug.print currentdb.tabledefs("atable").name
then
debug.print currentdb.tabledefs("junk").name

Signature
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com