-
Thanks for all the input guys, its been illuminating.
I like the idea of developing with early-binding, and then switching to Late and removing references before release. Sounds like the best of both worlds.
For the current issue, I've decided to go with pure late bound, with my own private consts to replace the ADODB library consts. Here is an example:
[vba]Option Explicit
Option Private Module
Private Const AccessDBPath As String = "\\REMOVED
Private Const AccessDBConStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & AccessDBPath
'ADODB Constants (needed due to Late Binding)
Private Const adUseClient = 3
Private Const adOpenStatic = 3
Private Const adLockReadOnly = 1
'
Sub PRForm_RefreshDept()
Dim strDept As String
Dim conDB As Object
Dim rstDB As Object
'If AccessDB is NOT available, then exit sub
If Dir(AccessDBPath) = Empty Then Exit Sub
'If DB is avail, repopulate options from DB
'Set up Objects, open DB connection
Set c Set rstDB = CreateObject("ADODB.Recordset")
rstDB.CursorLocation = adUseClient
conDB.Open AccessDBConStr
With ActiveSheet.ComboBox1
'store current value and clear out ComboBox
strDept = .Value
.Value = Empty
.Clear
'Re-populate ComboBox with entries from DB list
rstDB.Open "SELECT Department FROM Departments ORDER BY Department;" _
, conDB, adOpenStatic, adLockReadOnly[/vba]
...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules