Testing for existence of a query 
Author Message
 Testing for existence of a query

I use CreateQueryDef to create a temporary query and DeleteObject to
delete it when I've finished. Before I use CreateQueryDef I'd like to test
to see if a rogue query has been left over from earlier so that the
CreateQueryDef doesn't fail. I'm sure there is a
DoesQueryExist("queryname") function or similar, but I haven't yet found
it.

Thanks for any help.

Robert



Fri, 23 Apr 2004 20:13:00 GMT  
 Testing for existence of a query

Quote:

>I use CreateQueryDef to create a temporary query and DeleteObject to
>delete it when I've finished. Before I use CreateQueryDef I'd like to test
>to see if a rogue query has been left over from earlier so that the
>CreateQueryDef doesn't fail. I'm sure there is a
>DoesQueryExist("queryname") function or similar, but I haven't yet found
>it.

>Thanks for any help.

>Robert

Robert

There are several ways you can do this, including just trying to delete the
query, and trapping the error that occurs if the query doesn't exist. For more
info, look at this page on my site, which is about TableDefs, but the theory is
the same - http://www.applecore99.com/index.asp?page=tbl002

Jon

Access tips & tricks - http://www.applecore99.com
Microsoft Access webring - http://a.webring.com/hub?ring=microsoftaccess



Fri, 23 Apr 2004 20:37:02 GMT  
 Testing for existence of a query

Quote:



> >I use CreateQueryDef to create a temporary query and DeleteObject to
> >delete it when I've finished. Before I use CreateQueryDef I'd like to
> test >to see if a rogue query has been left over from earlier so that
> the >CreateQueryDef doesn't fail. I'm sure there is a
> >DoesQueryExist("queryname") function or similar, but I haven't yet
> found >it.

> >Thanks for any help.

> >Robert

> Robert

> There are several ways you can do this, including just trying to delete
> the query, and trapping the error that occurs if the query doesn't
> exist. For more
> info, look at this page on my site, which is about TableDefs, but the
> theory is the same - http://www.applecore99.com/index.asp?page=tbl002

> Jon

> Access tips & tricks - http://www.applecore99.com
> Microsoft Access webring - http://a.webring.com/hub?ring=microsoftaccess

Jon

Many thanks for this - I'll now go ahead and implement the
IfInDoubtDelete() routine...

Robert



Fri, 23 Apr 2004 22:23:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Testing for a queries existence

2. TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST

3. Testing for Existence of Table

4. Testing for a record already in existence

5. Test for table existence

6. Test for the existence of a table

7. test for existence of a field

8. Testing for table existence

9. Testing for table existence & listing available tables

10. Testing for file existence

11. Test for Contact EMail1Address existence

12. test existence of style

 

 
Powered by phpBB® Forum Software