How to: Let operators move the connections of a delivered application
Let the person who runs a delivered application point its linked tables to another server or database - a new SQL Server, a test database - without development access and without a new version.
Requires WKL Forms Object Library 1.51 or later; the tables are linked through WklLinkManager.
Solution overview
The application model releases what may be adjusted in operation: Verbindungen umstellen
(relinking) and named options. WklApplication.ShowSettings opens a small dialog with these settings
only - also in an ACCDE and the Access Runtime, where no designer is available. OK writes the values
that differ into the user's settings file outside the database and relinks the tables through
WklLinkManager.EnsureLinks. At every later start, EnsureLinks uses the same file, and a new
version of the application keeps it.
Implementation
- In the application designer, page Im Betrieb anpassbar, switch on Verbindungen umstellen. Optionally add options (for example
Branch, kind Auswahl, valuesWien;Graz) and fill in Wer die Einstellungen öffnen darf, for example a functionIsAdministratorof the application. Give the operator a way to open the settings, for example a button in the shell:
Private Sub cmdSettings_Click() On Error GoTo Failed If CreateObject("WklForms.Application").ShowSettings() Then Me.Requery End If Exit Sub Failed: MsgBox Err.Description, vbExclamation Resume Done Done: End SubRelink at every start, before the first form reads data (the start form or an AutoExec macro):
CreateObject("WklForms.LinkManager").EnsureLinks- Read an option where the application needs it:
CreateObject("WklForms.Application").OptionValue("Branch").
Remarks
- Where the values live: per user in
%LOCALAPPDATA%\WKL\<database>\settings.json, over the machine's%ProgramData%\WKL\<database>\settings.json, which an administrator can roll out. Only values that differ from the database are written; a connection is matched by its name. - A damaged file is reported by
EnsureApplicationand ignored: the application starts with the connections stored in the database. - Refused openings raise
wkeNotAvailablewithout a dialog: when the model releases nothing, or the condition does not hold for this user.
Related topics
- How to: Move connections to another server (with the Linked Tables Manager's designer)