I Simple want when user click on the combo box .the other corresponding detail should come in a text box.i have written a code but it is not working .Kindly help me.
any help would be Greatly appreciated.here is the code what i have written.
Private Sub CboEmpName_Click()
Dim con As ADODB.Connection, rs As ADODB.Recordset, sqlQuery As String
If Not OpenConnection(con) Then
MsgBox ("cannot open connection")
Set con = Nothing
End If
If CboEmpName.Text <> "" Then
Set rs = New ADODB.Recordset
rs.Open "Select * from employees where employees.name='" & Trim(CboEmpName.Text) & "'", con, adOpenDynamic, adLockOptimistic
' TxtPosition.AddItem (rs!Position)
TxtPosition.Text = IIf(IsNull(rs!Position), rs!Position, "")
End If
Call CloseRecordset(rs)
Call CloseConnection(con)
End Sub