G
gatarossi
Dear all,
I have this code that brings the MS Access data in a cell... but I
need that excel brings these data in a combobox (when I initialize a
userform)...
This is the code:
Sub return_approval()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim rs As DAO.Recordset
Set db = OpenDatabase(ThisWorkbook.Path & "\db_sales_pgm.mdb", False,
False, "MS Access;PWD=salespgm")
Set qdf = db.QueryDefs("qry_approval")
Set rs = qdf.OpenRecordset(dbOpenForwardOnly)
With ActiveSheet
.Cells(1, 1).CopyFromRecordset rs
End With
Set db = Nothing
Set qdf = Nothing
Set rs = Nothing
End Sub
This is the MS Access Query:
SELECT DISTINCT tbl_approval.doct_n
FROM tbl_approval;
My userform name's is frmQuery and the combobox name is cboApproval
Thanks in advance!!!
André.
I have this code that brings the MS Access data in a cell... but I
need that excel brings these data in a combobox (when I initialize a
userform)...
This is the code:
Sub return_approval()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim rs As DAO.Recordset
Set db = OpenDatabase(ThisWorkbook.Path & "\db_sales_pgm.mdb", False,
False, "MS Access;PWD=salespgm")
Set qdf = db.QueryDefs("qry_approval")
Set rs = qdf.OpenRecordset(dbOpenForwardOnly)
With ActiveSheet
.Cells(1, 1).CopyFromRecordset rs
End With
Set db = Nothing
Set qdf = Nothing
Set rs = Nothing
End Sub
This is the MS Access Query:
SELECT DISTINCT tbl_approval.doct_n
FROM tbl_approval;
My userform name's is frmQuery and the combobox name is cboApproval
Thanks in advance!!!
André.