Fill a Combo Box with two text boxes values

R

raymondskelton

The following function is used to fill a combo box from the values of
two text boxes. This function is called from the Record Source Type
property on the combo box. But it doesn't update on next record or
doesn't work in data entry mode. I looking for a way for the user to
select a primary email address from the values they enter in
txtHomeEmail and txtWorkEmail. Any suggestions would be greatly
appreciated.

Function ListEmail(Control As Control, id As Variant, _
row As Variant, column As Variant, _
code As Variant) As Variant
Static intRows As Integer
Static intColumns As Integer
Dim varDisplayData(1, 0) As Variant
Dim varRetVal As Variant
Dim stHome As String
Dim stWork As String



Select Case code
Case acLBInitialize
' Any necessary initialization code goes here.
' For example: determine number or rows and number
' of columns, save these values in the intRows and
' intColumns variables, and re-dimension the Static array
' varDisplayData().
intRows = 2
intColumns = 1
varRetVal = True
Case acLBOpen
' Return a unique id value here.
varRetVal = Timer
Case acLBGetRowCount
' Return the number of rows here.
varRetVal = intRows
Case acLBGetColumnCount
' Return the number of columns here.
varRetVal = intColumns
Case acLBGetColumnWidth
' Return the column widths here.
varRetVal = -1
Case acLBGetValue
' Return data to be displayed here.
stHome = Forms!Contacts![txtHomeEmail]
stWork = Forms!Contacts![txtWorkEmail]
varDisplayData(0, 0) = stHome
varDisplayData(1, 0) = stWork
varRetVal = varDisplayData(row, column)
Case acLBGetFormat
' Return formatting information here.
Case acLBEnd
' Perform any necessary clean up here.
End Select
ListEmail = varRetVal
End Function
 
R

raymondskelton

You Da Man! If this was a snake, it would have bit me. Thanks for your
help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top