I am trying to use a combo box which contains Field2 data of TableName to select a record from Field1 and put it into a TextBox. Here is the code I am trying to use.
Can anyone please help me ??
Can anyone please help me ??
Code:
Private Sub Combo11_Click()
Dim dbs As Database, rst As Recordset, strSQL As String
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("TableName")
strSQL = "SELECT Field1 FROM TableName where Field2= """ & Me.Combo11 & """"
Set rst = dbs.OpenRecordset(strSQL)
rst.MoveFirst
Me.TextBox = rst
End Sub