I want to set a dynamic default value for my combobox : combo11
I used this :
Me.Combo11.DefaultValue = DLookup(str)
While :
str = "EmpOperation", "tblEmp", "EmpNom ='" & Me.Label6.Caption & "'"
I am open to any non-VBA solution to this. Thanks
Full code :
Private Sub Form_Current()
If Not IsNull(Me.OpenArgs) Then
Me.Label6.Caption = Me.OpenArgs
End If
Me!Combo11.DefaultValue = DLookup("EmpOperation", "tblEmp", "EmpNom ='" & Me.Label6.Caption & "'")
End Sub
I get #NAME? error on the top value of my combo11
I found the solution !
It's as simple as removing the .defaultvalue
proprety :
Me.Combo11 = DLookup("EmpOperation", "tblEmp", "EmpNom ='" & Me.Label6.Caption & "'")