I am trying to set it up so that when someone enters the sap code, the description is filled in automatically. I have the info stored in a seperate table in the database. My problem is this. It goes to the first record in the file and displays the description for it. It does not sort through the whole thing. Here is the code I have. I believer the problem is in the do while loop. I am getting an error on the else so I believe the loop is stopping directly after the first following line. Can anyone help??
Here is my code.
THANKS A TON!!! lol
Here is my code.
Code:
Private Sub SAP_Code_AfterUpdate()
Dim vardesc As Variant
Dim tbl As Recordset
Set tbl = db.OpenRecordset("MatLookup")
tbl.MoveFirst
Do While Not tbl.EOF
vardesc = DLookup("description", "Mat Lookup", "SAP_code =" & [SAP_Code])
Forms!productionreconciliation![description] = vardesc
Else
tbl.MoveNext
Loop
End Sub
THANKS A TON!!! lol