• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

Access Forms - Changing Shared Link Data Source

Hi,

I wish to distribute my access forms to customers who do not have MS Access, i.e. they will execute them via the run time library.

My forms contain links to SQL Server DB tables only. These links need to be changed per customer during configuration/installation. The table names will be the same, but the host name, DB user, DB name may not.

Please tell me this is possible! I can't find out how to it. Do I need to create a form to handle it?

TIA!

Iain
0
mullykid
Asked:
mullykid
  • 6
  • 2
  • 2
1 Solution
 
peter57rCommented:
You just need a button to open the linked tables manager..

Private Sub Command0_Click()
DoCmd.RunCommand acCmdLinkedTableManager
End Sub
0
 
mullykidAuthor Commented:
Thanks Peter.

When I run it inside access it works.

When I run it via the run time library though it crashes. Do you know why? This is where I need it to work.

0
 
mullykidAuthor Commented:
Hi,

It appears this is not a run time feature, and other code is required.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
peter57rCommented:
Didn't realise this was regarded as a 'design' feature.

It's a lot of code then.
Here is a standard approach.

http://access.mvps.org/access/tables/tbl0010.htm

0
 
mullykidAuthor Commented:
Hi,

This appears to be for Oracle ODBC. Anything for SQL Server?
0
 
mullykidAuthor Commented:
Hi,

I think I may do this. Create a form so that the DBName, Server, user name and password etc. can be configured/entered by the user  (at install time for example) and then store this data and update the connection string for each Link table.

Can you show me how I would update the connection string with such variables?
0
 
Nick67Commented:
I just answered something very similar.
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_27381763.html?cid=1572#a36920121
Have a look and post if you wind up in the weeds.

TEST with the run-time.
The run-time is designed to be unhappy with design changes.
What works full blown may not work run-time, so TEST in that environment
0
 
mullykidAuthor Commented:
Hey Nick. Thanks for your reply.

The link doesn't seem to work. It loads a blank page. Can you give me your suggestion?
0
 
Nick67Commented:
It loads good on my units.
Try this link here
Here is the original code

Function Refresh_Table_Link()
On Error GoTo myerr
Dim TD As TableDef
Dim linkstring As String
Dim intSubStringLoc As Integer
For Each TD In CurrentDb.TableDefs
    If Len(TD.Connect) > 0 Then
        intSubStringLoc = InStr(TD.Connect, "WhateverBadNameYouHaveOnTheGo")
        If intSubStringLoc > 0 Then
                linkstring = SomeCodeThatIsYourNewConnectionString
                If TD.Connect <> linkstring Then
                    TD.Connect = linkstring
                End If
            TD.RefreshLink
        End If
    End If
Next

Exit Function
myerr:
MsgBox TD.Name
Resume Next

End Function
0
 
mullykidAuthor Commented:
Dude, thanks a million. Finally a sensible way of doing this.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now