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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AccessObject from VB 1

Status
Not open for further replies.

UncleHuckleberry

Technical User
Dec 4, 2003
58
GB
I'm trying to reference the access object library from vb and I need to use AccessObject to reference the dependencies for a query. This code is producing errors, any ideas why?

Dim ObjAccess As access.Application
Dim objParent As access.AccessObject

Set ObjAccess = New access.Application
Set objParent = ObjAccess.CurrentData.AllQueries.Item("queryname")

"When the going gets wierd, the wierd turn pro" - R. Duke
 
Have you referenced the Microsoft Access Object Library, via Project > References?

Everybody body is somebodys Nutter.
 
Yep, all references present and correct

"When the going gets wierd, the wierd turn pro" - R. Duke
 
I notice that your code opens a new access database, do you then reference the database with your Queries?
If you open a new Database there will be no Queries and your code will crash at the line:

Code:
   Set objParent = ObjAccess.CurrentData.AllQueries.Item("queryname")

Are you trying to run a pre-created query?, Create a new query?

Everybody body is somebodys Nutter.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top