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

  • SEARCH
  • Home
  • 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 806843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:18:33+00:00 2026-05-15T00:18:33+00:00

I have created a module in access 2007 that will update linked tables, but

  • 0

I have created a module in access 2007 that will update linked tables, but I wanted to run this module from vb6. I have tried this code from Microsoft, but it didnt work.

      Sub AccessTest1()
      Dim A As Object

      Set A = CreateObject("Access.Application")
      A.Visible = False

      A.OpenCurrentDatabase (App.Path & "/DataBase/acc.accdb")

      A.DoCmd.RunMacro "RefreshLinks"

   End Sub

What I am aiming to do, is to allow my program to update all linked tables to new links, in case the program has been used on other computer

In case you want to take a look at the module program, here it is:

Sub CreateLinkedJetTable()
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table

Set cat = New ADOX.Catalog

' Open the catalog.
cat.ActiveConnection = CurrentProject.Connection

Set tbl = New ADOX.Table

' Create the new table.
tbl.Name = "Companies"
Set tbl.ParentCatalog = cat

' Set the properties to create the link.
tbl.Properties("Jet OLEDB:Link Datasource") = CurrentProject.Path & "/db3.mdb"
tbl.Properties("Jet OLEDB:Remote Table Name") = "Companies"
tbl.Properties("Jet OLEDB:Create Link") = True

' To link a table with a database password set the Link Provider String
' tbl.Properties("Jet OLEDB:Link Provider String") = "MS Access;PWD=Admin;"

' Append the table to the tables collection.
cat.Tables.Append tbl
Set cat = Nothing

End Sub

Sub RefreshLinks()
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table

Set cat = New ADOX.Catalog

' Open the catalog.
cat.ActiveConnection = CurrentProject.Connection

Set tbl = New ADOX.Table

For Each tbl In cat.Tables
' Verify that the table is a linked table.
    If tbl.Type = "LINK" Then
        tbl.Properties("Jet OLEDB:Link Datasource") = CurrentProject.Path & "/db3.mdb"
' To refresh a linked table with a database password set the Link Provider String
'tbl.Properties("Jet OLEDB:Link Provider String") = "MS Access;PWD=Admin;"
    End If
Next
End Sub
  • 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-15T00:18:33+00:00Added an answer on May 15, 2026 at 12:18 am

    The mistake here is that all of the functions are subs, to make the Macro run i have to either do one of the following

    Change each sub into Public Function or create a function that calls both sub example

    public function Refresh()
      RefreshLinked
    end Function`
    

    and then create a Marco and in Action look for Run code, and look up for the function and everything well work fine

    Thanks people

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

Sidebar

Related Questions

So I have created a custom module for Drupal 6.x and it works as
I have created a simple mod_perl module, which writes a 0-terminated string to the
i have to create a login module (The question is not language specific) but
I have created a precompiled user control . The basic steps are to create
I have finally created a very simple Hello World style PHP Extension dll on
I have spent some time trying to create a child window of an existing
I'm testing django right now on Max OS X Snow Leopard Server. I have
I have extended Magento’s customer information form to store an additional attribute for customer.
I'm working For my company on a .NET N-tier architecture and have several questions.
I need a memory-efficient data structure for for storing about a million key--value pairs,

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.