Hi,
I've created a combo box that when you click on the list it brings up 3 columns with a number field and then a first and last name field. Note that this data is stored in a different table. When selected/changed, i want the data to input in the current table fields accordingly...
So here's what i've got...
Private Sub AgentId_Change()
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("tblAgent", dbOpenDynaset)
With rs
.MoveFirst
.FindFirst "AgentId = """ & Me.AgentId & """"
If .NoMatch Then
'MsgBox "No Match Found"
Else
Me.AgentFirstName = ![AgentFirstName]
Me.AgentLastName = ![AgentLastName]
Me.AgentStatus = ![AgentStatus]
End If
End With
Set rs = Nothing
End Sub
I have the same code in another table that im using and it works perfectly, except in this new forum i've created it will not work. I keep getting the "data type mismatch in criteria expression" error. Or it doesn't populate the fields and doesnt give me an error...
Any ideas?
I've created a combo box that when you click on the list it brings up 3 columns with a number field and then a first and last name field. Note that this data is stored in a different table. When selected/changed, i want the data to input in the current table fields accordingly...
So here's what i've got...
Private Sub AgentId_Change()
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("tblAgent", dbOpenDynaset)
With rs
.MoveFirst
.FindFirst "AgentId = """ & Me.AgentId & """"
If .NoMatch Then
'MsgBox "No Match Found"
Else
Me.AgentFirstName = ![AgentFirstName]
Me.AgentLastName = ![AgentLastName]
Me.AgentStatus = ![AgentStatus]
End If
End With
Set rs = Nothing
End Sub
I have the same code in another table that im using and it works perfectly, except in this new forum i've created it will not work. I keep getting the "data type mismatch in criteria expression" error. Or it doesn't populate the fields and doesnt give me an error...
Any ideas?