J
Jeremyb
I have written a form and work flow that looks up names in a MDB file to
populate a combo box.
This works fine as long as I have Access installed on PC.
But most users who'll use the form don't have MS Access installed.
The code I am using is:
Function FillComboBox()
Set objAccess = Item.Application.CreateObject("Access.Application")
strAccessDir = "H:\My Documents\"
strDBName = strAccessDir & "Northwind.mdb"
'MsgBox "DBName: " & strDBName
objAccess.Quit
Set dao = Application.CreateObject("DAO.DBEngine.36")
Set wks = dao.Workspaces(0)
Set db = wks.OpenDatabase(strDBName)
Set rst = db.OpenRecordset("Employee")
Set ctl = Item.GetInspector.ModifiedFormPages("RAR
Form").Controls("RARRequestFor")
ctl.ColumnCount = 1
ctl.ColumnWidths = "75 pt;"
CategoryArray(99, 2) = rst.GetRows(200)
ctl.Column() = CategoryArray(99, 2)
It errors at the Set objAccess line, because Access is not available.
How can I code this so that MS Access is not required.
I am a beginner with coding and need a little help to just get this correct.
I am so close to getting this to work.
Thanks
Jeremy
populate a combo box.
This works fine as long as I have Access installed on PC.
But most users who'll use the form don't have MS Access installed.
The code I am using is:
Function FillComboBox()
Set objAccess = Item.Application.CreateObject("Access.Application")
strAccessDir = "H:\My Documents\"
strDBName = strAccessDir & "Northwind.mdb"
'MsgBox "DBName: " & strDBName
objAccess.Quit
Set dao = Application.CreateObject("DAO.DBEngine.36")
Set wks = dao.Workspaces(0)
Set db = wks.OpenDatabase(strDBName)
Set rst = db.OpenRecordset("Employee")
Set ctl = Item.GetInspector.ModifiedFormPages("RAR
Form").Controls("RARRequestFor")
ctl.ColumnCount = 1
ctl.ColumnWidths = "75 pt;"
CategoryArray(99, 2) = rst.GetRows(200)
ctl.Column() = CategoryArray(99, 2)
It errors at the Set objAccess line, because Access is not available.
How can I code this so that MS Access is not required.
I am a beginner with coding and need a little help to just get this correct.
I am so close to getting this to work.
Thanks
Jeremy