Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

As Database inexistant! 1

Status
Not open for further replies.

Kherozen

Programmer
Jun 5, 2003
129
CA
Hi, I'm currently doing a custom search
and I try copying the code posted here which is

Dim dbName as Database
Dim qryDef as QueryDef
set dbName = currentdb()
...
...'here I construct stSQL it isn't useful for this post
set qryDef =dbName.QueryDefs("myQuery")
qryDEf.SQL = stSQL
Docmd.OpenQuery "myQuery", acViewNormal

ok the code seem highly logical but "as Database" and "as QueryDef" give me the "User-Defined Type Not Declared"

i'm using Access 2000 ( .adp , SQL Server 2000)
which I guess is where the problem is but what is the turn-around?!?

jul ^_^
 
Hi Kherozen

Wile in the Visual Basic Editor, from the menu select Tools>> References if Microsoft Data Access Objects 3.x Library is not checked, scroll down to find the highest version no. check.tick it.

Change the code above in either case to:

Dim dbName as DAO.Database
Dim qryDef as DAO.QueryDef

Bill

 
Hi Bill
it turns out that you were right! so thank you

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top