473,396 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Open a query or table in another database in design view.

I am trying to view the design of tables and queries in another database.

This is the code on a form, "ObjectName.Column(0))" is the name of a table
or query selected from the other database. I also have the ObjectID which is
in the other database MSysObjects (in case it is needed).

Case 1 is for tables and case 5 is queries.

The Set OtherTableDef and Set OtherQueryDef work OK, but not the OpenTable
Error is "Microsoft Acces can't find the object ........"

Any ideas

Thanks

Phil

Private Sub ObjectName_DblClick(Cancel As Integer)
Dim AccApp As Access.Application
Dim OtherDb As Database
Dim OtherTableDef As TableDef
Dim OtherQueryDef As QueryDef

On Error GoTo ShowObject_Err
' Save for later

Set AccApp = New Access.Application
Set OtherDb = AccApp.DBEngine.OpenDatabase(DatabaseName, False, False,
Nz(PWD))

Select Case ObjectTypeID

Case 1 'Tables
Set OtherTableDef = OtherDb.TableDefs(ObjectName.Column(0))
' This works
DoCmd.OpenTable OtherTableDef.Name, acViewDesign
' This doesn't work

Case 5 'Queries
Set OtherQueryDef = OtherDb.QueryDefs(ObjectName.Column(0))
' This works
DoCmd.OpenQuery OtherQueryDef.Name, acViewDesign
' This doesn't work

Case Else
MsgBox "Unknown Error", vbCritical

End Select
Exit Sub

ShowObject_Err:
MsgBox Err.Description

End Sub
Dec 13 '06 #1
0 1238

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

55
by: Steve Jorgensen | last post by:
In a recent thread, RKC (correctly, I believe), took issue with my use of multiple parameters in a Property Let procedure to pass dimensional arguments on the basis that, although it works, it's...
2
by: Bill Hand | last post by:
Is it possible to open a form from table and have it access a given record? I want to be able to query all baseball cards with the last name Jones and have it open a table. In each record of...
6
by: sghi | last post by:
Hi All, I'm new to this group and quite new to access/vba. So, shortly after beginning to write a simple application for my wife, I came across a blocking problem: I need to intercept the sql...
15
by: kokostik | last post by:
I did a few searches, but couldn't come up with a clear answer to my question. So here it is: If I am in an open form (MyForm1), is it possible to set the RecordSource of an un-opened form...
3
by: KNN | last post by:
Hi I have some tables with hidden attribute set to 1. In the query desgn view , I do not see these tables as expected. But, If I choose the query wizard to create a new query, then i do see...
3
by: MLH | last post by:
An A97 application that sometimes stays open for days at a time may have a form, report, table or query open in design view. What's the simplest code snippet that would determine whether any...
1
by: littlbit755 | last post by:
I am using Access 2003 at work and had created a summary report showing the financial information for year to date. As of last week the report ran great. Today I was asked to make a change in the...
2
by: existential.philosophy | last post by:
This is a new problem for me: I have some queries that open very slowly in design view. My benchmark query takes about 20 minutes to open in design view. That same query takes about 20 minutes...
5
9815402440
by: 9815402440 | last post by:
hi i am using acess 2003 as back end of my application. database was fine a few days back. i have a table named Ac_LedgerMaster. i have several tables that are related to this table. now relations...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.