Hi, everybody!
coes, give the code a try in a bound form that have some text boxes etc and a combobox with the name "Combo0" which has two columns and set 0 cm as width of the first.
Code:
Option Compare Database
Option Explicit
Private Sub Form_Load()
FillCombo
End Sub
Sub FillCombo()
Dim ctrl As Control
Dim strList As String
For Each ctrl In Me.Controls
If (TypeName(ctrl) = "TextBox") Or (TypeName(ctrl) = "ComboBox") Then
If ctrl.Name <> Me.Combo0.Name Then
strList = strList & ctrl.ControlSource & ";" & ctrl.Name & ";"
End If
End If
Next ctrl
With Me.Combo0
.RowSource = strList
.RowSourceType = "Value List"
End With
End Sub
Private Sub Combo0_AfterUpdate()
With Me.Combo0
'It would be a filter for your form if all criteria was text
MsgBox "[" & .Value & "]='" & Me.Controls(.Column(1)) & "';"
End With
End Sub
Let us know if suit your needs.
Good luck!