From: TF on
I'm fairly new to VBA programming and am in need of help!

I have a form that has a ComboBox object. Can someone help by posting
code that would assign a customized field, (let's say, Text1) as it's
Control Source, RowSourceType as a value list, and values (let's say,
"yes", "no") as it's RowSource?

I'd really appreciate any feedback.

From: Mike Glen on
Hi TF,

Try posting on the developer newsgroup. Please see FAQ Item: 24. Project
Newsgroups. FAQs, companion products and other useful Project information
can be seen at this web address: http://project.mvps.org/faqs.htm

Mike Glen
Project MVP



"TF" <tonyafranklin316(a)hotmail.com> wrote in message
news:1169068099.710249.239050(a)11g2000cwr.googlegroups.com...
> I'm fairly new to VBA programming and am in need of help!
>
> I have a form that has a ComboBox object. Can someone help by posting
> code that would assign a customized field, (let's say, Text1) as it's
> Control Source, RowSourceType as a value list, and values (let's say,
> "yes", "no") as it's RowSource?
>
> I'd really appreciate any feedback.
>
>



From: John on
In article <1169068099.710249.239050(a)11g2000cwr.googlegroups.com>,
"TF" <tonyafranklin316(a)hotmail.com> wrote:

> I'm fairly new to VBA programming and am in need of help!
>
> I have a form that has a ComboBox object. Can someone help by posting
> code that would assign a customized field, (let's say, Text1) as it's
> Control Source, RowSourceType as a value list, and values (let's say,
> "yes", "no") as it's RowSource?
>
> I'd really appreciate any feedback.

TF,
First of all the RowSourceType Property applies only to Excel. Second,
are you sure you want a ComboBox and not a ListBox? Nonetheless, the
following code will set up a userform ComboBox with the list values from
custom Task Text1:

Private Sub UserForm_initialize()
On Error Resume Next
For i = 1 To 10
UserForm1.ComBx1.AddItem
CustomFieldValueListGetItem(pjCustomTaskText1, pjlistvalue, i)
If Err > 0 Then Exit For
Next i
On Error GoTo 0
End Sub

Note: the error function is needed since the CustomFieldListGetItem
doesn't have a Count Property. I arbitrarily set the upper limit on the
index ("i") at 10. Increase or decrease it if you have a reasonable idea
of how many values are in the list.

Hope this helps.
John
Project MVP