[RESOLVED] combo box in outlook vba not showing items
Hey,
I've manged to write with a lot of help from this forum, this small outlook vba code that shows a combo box for selecting items from an mdb file.
problem is:
1. When I put this code in the load form of the form it doesn't add any items to the combox, but if I add it to a dummy button then the combox items are loaded ok.
2. I'd like to add this combo box to a toolbar in outlook and not create a new form for it.
thanks, and here's my code:
AccessConnect = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=my_DB.mdb;" & _
"DefaultDir=q:\;"
Conn1.ConnectionString = AccessConnect
Conn1.Open
Set Rs1 = Conn1.Execute("SELECT * FROM Customers")
Rs1.MoveFirst
While Not (Rs1.EOF)
Customer_Select.AddItem Rs1("customer_no") & "-" & Rs1("customer_name")
Rs1.MoveNext
Wend
Conn1.Close
Re: combo box in outlook vba not showing items
Is this in a UserForm or a regular Outlook Form?
Re: combo box in outlook vba not showing items
this is in a new form i've added, but what I'd want to do with it is add the combox as a part of a toolbar.
Re: combo box in outlook vba not showing items
So your saying your creating a new Form from the Design the Forms menu? If your wanting to add a combo to a toolbar on your form, does it already have a toolbar on it and you just need to add the cbo?
Re: combo box in outlook vba not showing items
ok, I should describe it from the begining:
the code above is a part of a form I've created with a cbo I've put it and wrote the code.
what I need in the end is to add a cbo in an outlook toolbar so that the user can choose an item from the list an the code will act upon it.
my questions are:
1. how to add the cbo into a toolbar in outlook?
2. where to put this code so that it loads once outlook is loaded/ the cbo is opened.
3. where to add an event code for selecting an item from the cbo.
thank you (and sorry for not beinhg clear on this one)
Re: combo box in outlook vba not showing items
It depends upon the type of form you create it from. Either in Outlooks Form designer, VBA IDE UserForm, VB 6 Form.
:)
Re: combo box in outlook vba not showing items
(I've created this form in outlook from designer)
- What I'd like to do is create a combo box toolbar in outlook with this code behind it.
Re: combo box in outlook vba not showing items
Re: combo box in outlook vba not showing items
common, is this that complicated to do? am I not clear in what I want ? anyone?
Re: combo box in outlook vba not showing items
You will need to create a toolbar using the CommandBars collection. Add a combox to it and populate it. Since there s no control to drag and drop on the outlook form, you need to do this at run time either in VB Script behind the form or in the VBA IDE adding it to the Inspector item.