I hate be such a bother, but it still isn't working. Here is exactly what my code says. I took out the exit because it was giving me errors.
Production Reconciliation=>form name
Description=>field name for both the "mat lookup" table and the form
SAP Code=> field name for both the "mat lookup" table and the form
I really appreciate this.
Private Sub SAPCode_LostFocus()
Forms![productionreconciliation]![description].SetFocus
If description() <> "" Then
Forms![productionreconciliation]![description] = description()
Else
MsgBox "Error message!!"
End If
Forms![productionreconciliation]![pallettagcount].Set Focus
End Sub
Private Sub SAP_Code_lostfocus()
Function description() As String
Dim db As Database
Dim tbl As Recordset
Set db = CurrentDb
Set tbl = db.OpenRecordset("MatLookup"
tbl.MoveFirst
Do While Not tbl.EOF
If tbl![SapCode] = Forms![productionreconciliation]![SapCode] Then
Forms![productionreconciliation]![description] = tbl![description]
Else
tbl.MoveNext
Loop
End Function