Populate custom form from SQL DB

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to VBA/Outlook development and am trying to populate a dropdownlist in my custom form with data that is in a SQL DB. I haven't been able to find any resources helping to explain HOW to do this (with examples). Some sample code would REALLY be appreciated as well as any other help that anyone can offer. Thanks much!
 
There's a lot of database/Outlook information and sample code at
http://www.slipstick.com/dev/database.htm

The idea with a ComboBox would be to take the recordset you have,
iterate it and use the AddItem method of the ComboBox to add each item
in the recordset to the control. To do it in one step you would
populate a Variant array from the recordset and use the List property:
ComboBox1.List() = MyArray




Brian said:
I am new to VBA/Outlook development and am trying to populate a
dropdownlist in my custom form with data that is in a SQL DB. I
haven't been able to find any resources helping to explain HOW to do
this (with examples). Some sample code would REALLY be appreciated as
well as any other help that anyone can offer. Thanks much!
 
Or, even easier, return a RecordSet with only the fields you want to include in the list, then set the Column property of the list to myRecordSet.GetRows. Listing 23.6 in my book shows the details; sample code available at http://www.outlookcode.com from the 'get the code' link.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
Back
Top