DLookup Question (1 Viewer)

mshelley1

Carbo
Local time
Today, 02:31
Joined
Feb 12, 2006
Messages
45
The following VBA code searches for the serial number of an item in flat-file table. What I need is to modify the code so that if a match is found for the serial number the message box will show the information in the “description” column of the same record.




Table has columns as follows:
Item, Serial, Model, description, location,

Private Sub Serial_LostFocus()
If IsNull(DLookup("[Serial]", "StolenProperty", "[serial]='" & Me![Serial] & "'")) = False Then
MsgBox "This serial number matches a number already in the system", vbOKOnly, ("GDB2000se")

End If
End Sub
 

Rabbie

Super Moderator
Local time
Today, 08:31
Joined
Jul 10, 2007
Messages
5,906
Try this.


Code:
Private Sub Serial_LostFocus()
If IsNull(DLookup("[description]", "StolenProperty", "[serial]='" & Me![Serial] & "'")) = False Then
MsgBox "This serial number matches a number already in the system", vbOKOnly, ("GDB2000se")

End If
End Sub
 

Users who are viewing this thread

Top Bottom