talytech
06-10-2011, 05:50 AM
I have a UserForm with a combo box named: cboVendor
I have opened up an MS Access database via DAO and I want the rowsource for that combo box to be a sql statement. when I try to open the form it produces an error. Here's what I have:
Dim wrkJet As Workspace
Dim dbsContractorsBI As Database
Dim rstVendorList As Recordset
Dim myRow As String
'Open Microsoft Jet and ODBCDirect workspaces, Microsoft
'Jet database, and ODBCDirect connection.
DBEngine.SystemDB = "C:\Documents and Settings\e3utbl\Desktop\Devl Databases\ContractorsDbaseStuff\CSSGrp.mdw"
Set wrkJet = CreateWorkspace("", "test", "test2", dbUseJet)
Set dbsContractorsBI = wrkJet.OpenDatabase("C:\Documents and Settings\e3utbl\Desktop\Devl Databases\ContractorsDbaseStuff\ConBI_FE.mdb")
myRow = "SELECT tblVendorList.CompanyID, tblVendorList.CompanyName FROM tblVendorList ORDER BY tblVendorList.CompanyName;"
cboVendor.RowSourceType = myRow
I have opened up an MS Access database via DAO and I want the rowsource for that combo box to be a sql statement. when I try to open the form it produces an error. Here's what I have:
Dim wrkJet As Workspace
Dim dbsContractorsBI As Database
Dim rstVendorList As Recordset
Dim myRow As String
'Open Microsoft Jet and ODBCDirect workspaces, Microsoft
'Jet database, and ODBCDirect connection.
DBEngine.SystemDB = "C:\Documents and Settings\e3utbl\Desktop\Devl Databases\ContractorsDbaseStuff\CSSGrp.mdw"
Set wrkJet = CreateWorkspace("", "test", "test2", dbUseJet)
Set dbsContractorsBI = wrkJet.OpenDatabase("C:\Documents and Settings\e3utbl\Desktop\Devl Databases\ContractorsDbaseStuff\ConBI_FE.mdb")
myRow = "SELECT tblVendorList.CompanyID, tblVendorList.CompanyName FROM tblVendorList ORDER BY tblVendorList.CompanyName;"
cboVendor.RowSourceType = myRow