DLookUp Help Again

mmiraj

New member
Local time
Today, 13:29
Joined
Apr 16, 2002
Messages
5
Dim varLastName, FirstName As Variant
varLastName = DLookup("LastName", "Registrasi_Tamu", "TamuID =[TamuID]")

varFirstName = DLookup("FirstName", "Registrasi_Tamu", "TamuID =[TamuID] ")
If (Not IsNull(varLastName)) Then Me!LastName = varLastName
If (Not IsNull(varFirstName)) Then Me!FirstName = varFirstName

This is my auto Fill fields on my form
This is working for auto-fill with dLookUp.
Each TamuID comes with different FirstName and LastName (in my table).

the problem is everytime I input(I press Enter button everytime I put the data in) TamuID with different number, it always shows same FirstName and LastName, infact, there should be different FirstName and LastName.
No change at all

Anybody can help me!!!

Thank you for your attention
 
Try this instead:

If Tamuid is a number field:
DLookup("LastName", "Registrasi_Tamu", "TamuID =" & me![TamuID])

If Tamuid is a text field:

DLookup("LastName", "Registrasi_Tamu", "TamuID ='" & me![TamuID]& "'")
 

Users who are viewing this thread

Back
Top Bottom