Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6683495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:49:41+00:00 2026-05-26T04:49:41+00:00

Using an ADODB connection object, I am able to use SQL DDL with MS

  • 0

Using an ADODB connection object, I am able to use SQL DDL with MS Access (joy!). The odd thing is that sometimes declared foreign key references show up in Access’ Relationship View – this would be great for visualization, and to print off to show stakeholders – but sometimes it doesn’t. For example, I create an Employees table, and a Dep_Policy table with a foreign key reference to Employees (example from Ramakrishnan book). This shows in the relationship view. I now create two new tables using the same DDL, but change the names to Cat and Dog, as a test. Only Dog shows in the Relationship view, not Cat. Here’s the code:

Sub createTestSchema()

Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command

Set cnn1 = CurrentProject.Connection
Set cmd1 = New ADODB.Command

Dim sqlArr As ArrayList
Set sqlArr = New ArrayList
sqlArr.Add ("CREATE TABLE Employees(ssn integer identity(0,1), name text(100), lot     text(50), primary key (ssn))")
sqlArr.Add ("CREATE TABLE Dep_Policy(pname text(20), age integer, cost currency, ssn integer, primary key (pname, ssn)," & _
            "FOREIGN KEY (ssn) references Employees(ssn) ON DELETE CASCADE)")
sqlArr.Add ("CREATE TABLE Cat(ssn integer identity(0,1), name text(100), lot text(50), primary key (ssn))")
sqlArr.Add ("CREATE TABLE Dog(pname text(20), age integer, cost currency, ssn integer, primary key (pname, ssn)," & _
            "FOREIGN KEY (ssn) references Cat(ssn) ON DELETE CASCADE)")
With cmd1
    .ActiveConnection = cnn1
    .CommandType = adCmdText
    Dim i As Integer
    For i = 0 To sqlArr.size - 1
        .CommandText = sqlArr.GetItem(i)
        .Execute
    Next
End With
End Sub

How do I ensure that the foreign key references show up in the Relationship view? For this test schema, most tables appear but in my actual schema few appear. Using MS Access is a client requirement. (btw ArrayList is a custom class)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:49:42+00:00Added an answer on May 26, 2026 at 4:49 am

    In earlier versions, you’d right-click the workspace in the “Relationships” window, and select “Show all”.

    Showing all tables and their relationships wasn’t (isn’t?) the default, because in a database that has 500 tables, the diagram would be mostly unreadable. In fact, in most databases, automatically showing all tables and relationships makes an unreadable diagram. It takes a fair bit of moving things around manually, and often selecting just closely related parts of a schema at a time, to make a readable diagram.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using VBA i have a set of functions that return an ADODB.Recordset where all
anyone have examples of sophisticated WORD 2007 forms that posts to access DB using
I'm trying to access a large Oracle database through SQL Server using OPENROWSET in
I'm using ADODB library for sql manipulation, but i'm wondering if there is way
When using classic ASP, what is the difference between declaring connection via object tag:
I'm using an OLEDB connection to a Sybase database, with ADODB.dll file version 7.10.6070.0
I am using SQLite3 ODBC Driver as my connection string, Dim conn As ADODB.Connection
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.