I have the following VBA code to populate unbound fields in an unbound form in Access 2010 :
Private Sub Combo0_AfterUpdate()
Dim D As Database
Dim rsExp As Recordset
Dim Criteria As String
Set D = CurrentDb
Set rsExp = D.OpenRecordset("ExpAsset", DB_OPEN_DYNASET)
Criteria = "[serial_number]=" & [Combo0]
rsExp.FindFirst Criteria
Me!Name = rsExp("User")
Me!Type = rsExp("Type")
Me!MODEL = rsExp("Model")
Me!Notes = rsExp("Notes")
Me!Department = rsExp("Department")
Me!Status = rsExp("Status")
rsExp.Close
End Sub
I am getting error on this line rsExp.FindFirst Criteria runtime error 3077 Syntax error (Missing operator) in expression.
I have changed the code to Criteria = "[serial_number]=" & Str([Combo0]) but then i get runtime error 13 type mismatch.