compare text box to combo box list

I have a button that deletes a Purchase Requesition form.  I have the button set up for the person who entered the form can delete it.  I would like to allow some managers to be able to delete the form also.  

I have a combo box (ApprovalCombo) that lists all the managers - I am using this list for the apporval process.  I have "UserLogName" = Environ ("username") - so when the manager selects his name from the combbox I can compare with the username of the PC to allow approval.

What I would like to do for the delete is to compare the UserLogName to all the values listed in the combo box - If the UserLogName is on the list - they can delete the form.

Thanks for your help.
Who is Participating?
thenelsonConnect With a Mentor Commented:
Where are the values listed in the combo box coming from?

A table or query? Use:
If DCount ("AnyFieldInTableOrQuery",  "TableOrQueryName", "UserLogNameFieldName" = " & UserLogName) Then

A value List? Use:
If InStr (ComboboxName.RowSource, UserLogName) Then
Hi johnmadigan, here is example code for VB6:

                With ApprovalCombo
                    For j = 0 To .ListCount - 1
                        If .ItemData(j) = UserLogName Then
                            ' allow delete here
                            Exit For
                        End If
                End With
johnmadiganAuthor Commented:
Thanks - the "If InStr (ApprovalCombo.RowSource, UserLogName) Then" worked perfectly - just what I needed - thanks for your help!
You're welcome.  Glad to help and thank you very much for the points with "A" grade!

Happy computing!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.