Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform Combobox Excel 2003
Hello,
is it possible to link programmatically a userform combobox to a table of one external Access mdb file? Thanks, Emiliano |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform Combobox Excel 2003
In short Yes. Not an easy task but very doable, Here is what you need to do,
first create a referance to Microsoft DAO 3.6 Object library Tools-References-Microsoft DAO 3.6 Object library then in the UserForm_Initialize() YourProcedureName End Sub in a Standard code module place the following Public Sub YourProcedureName Dim DAO As DAO.DBEngine Dim YourDB As DAO.DataBase Dim YourRS As DAO.Recordset Dim i As Integer Dim Count As Integer Set DAO = New DAO.DBEngine Set YourDB = DAO.OpenDatabase("C:\Documents and Settings\Desktop\db1.mdb") Set YourRS = YourDB.OpenRecordset("Sampledb") Count = YourRS.Fields.Count For i = 0 To Count - 1 UserForm1.ComboBox1.AddItem YourRS.Fields(i).Name Next Set YourRS = Nothing Set YourDB = Nothing Set DAO = Nothing End Sub You will have to change the example to suit your database name and recordset but the rest should work fine. Good luck. "eggpap" wrote: Hello, is it possible to link programmatically a userform combobox to a table of one external Access mdb file? Thanks, Emiliano |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ComboBox problem - Excel 2003 | Excel Programming | |||
Sort order via excel userform combobox | Excel Programming | |||
Value from Combobox to Cell (Excel 2003) | Excel Programming | |||
ComboBox with horizontal range on an Excel USERFORM | Excel Programming | |||
Linking userform to userform in Excel 2003 | Excel Programming |