Results 1 to 1 of 1
  1. #1
    AccessMasterFromTheStart is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Location
    Wisconsin
    Posts
    2

    Open Link Table list with VBA?

    Hello Everyone!

    I have very specific reasons for this particular request.

    I want to open the Link ODBC tables dialog box and be viewing the remote data tables list so that I can select the the needed table.

    I want to do this programmatically.

    In Access 2010 This is done manually by:
    Clicking the "External Data" Tab on the ribbon
    Then Clicking "ODBC Datebase"
    Then Clicking "Link to the data source by creating a linked table"
    Then by selecting the desired DSN file
    Then entering the password

    Then next thing that opens is the "Link Tables" window. <<<<<<<<<<<< This is where I need to be VIA code.
    This is where I need to be programmatically via VBA with MS Access

    I already know how to link via code. In my case, in this request, that is Not what I want to do.



    Very specifically, I am required to open the "Link Tables" window with VBA code without using sendkeys or pre-stored macros.
    The image below shows where I am required to be when a single button on our form is clicked.

    Click image for larger version. 

Name:	LinkTablesDialog.JPG 
Views:	19 
Size:	67.7 KB 
ID:	6478
    If anyone knows how to do this please let me know asap.

    Thank you





    AFTER EXTENSIVE SEARCHING...
    I settled

    Dim stConnect As String
    stConnect = "PROVIDER=SQLOLEDB.1;PERSIST SECURITY INFO=FALSE;INITIAL CATALOG=" & SQLServerDataBaseName & ";DATA SOURCE=" & SQLServerConnection & ",1433;USER ID=" & SQLServerUN & ";PASSWORD=" & SQLServerPW

    'OR USE the difference is the SQLServerIP versus SQLServerConnection

    'IMPORTANT netsol needs the ",1433" after the SQLServerIP or SQLServerConnection
    However some other servers do not require it."000.000.000.000,1433" replacing 000 with the actual ip, of course

    'stConnect = "PROVIDER=SQLOLEDB.1;PERSIST SECURITY INFO=FALSE;INITIAL CATALOG=" & SQLServerDataBaseName & ";DATA SOURCE=" & SQLServerIP & ",1433;USER ID=" & SQLServerUN & ";PASSWORD=" & SQLServerPW


    Dim DBOdbWT As ADODB.Connection
    Dim DBOrsWT As ADODB.Recordset
    Set DBOdbWT = New ADODB.Connection

    DBOdbWT.Open stConnect
    Set DBOrsWT = DBOdbWT.OpenSchema(adSchemaTables, Array(Empty, Empty, Empty, "Table"))
    With DBOrsWT
    Do While Not DBOrsWT.EOF
    TablesListVar = TablesListVar & !TABLE_NAME & vbCrLf
    DBOrsWT.MoveNext
    Loop
    DBOrsWT.Close
    End With
    DBOdbWT.Close

    MsgBox "The Following is a list of tables in the Remote ODBC Database """ & SQLServerDataBaseName & """" & vbCrLf & vbCrLf & TablesListVar, , "RemoteODBC Tables List"

    This should produce a list of remote tables in the db from here you can do what is needed with the list.
    Last edited by AccessMasterFromTheStart; 02-27-2012 at 11:52 AM. Reason: Partial Solution

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 12-20-2011, 07:33 AM
  2. Replies: 2
    Last Post: 08-01-2011, 11:35 PM
  3. Open website from list box
    By kev921hs in forum Programming
    Replies: 4
    Last Post: 05-24-2010, 01:43 AM
  4. Open form from a drop down list
    By ildanach in forum Forms
    Replies: 15
    Last Post: 05-21-2009, 05:40 AM
  5. Open Form with a drop down list box
    By Rinehart in forum Forms
    Replies: 0
    Last Post: 08-10-2008, 08:53 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums