Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ComboBox problem - Excel 2003 HappySenior Excel Programming 1 July 28th 08 05:40 AM
Sort order via excel userform combobox [email protected] Excel Programming 3 July 17th 07 03:29 PM
Value from Combobox to Cell (Excel 2003) [email protected] Excel Programming 0 February 23rd 06 05:02 PM
ComboBox with horizontal range on an Excel USERFORM ca1358 Excel Programming 3 January 19th 06 10:25 PM
Linking userform to userform in Excel 2003 missmelis01 Excel Programming 2 August 27th 04 08:07 PM


All times are GMT +1. The time now is 06:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"