Combo Box Issue

mardi 28 avril 2015

Please help!

I have this combo Box and use this code to populate to other fields:
Private Sub ServiceCode_Exit(Cancel As Integer)
Dim varSerC, varDiag, varRate As Variant
varSerC = DLookup("ServiceCode", "Service List", "ServiceCode = [ServiceCode] ")
varDiag = DLookup("Diagnosis", "Service List", "ServiceCode = [ServiceCode] ") & " - " & DLookup("ServiceTitle", "Service List", "ServiceCode = [ServiceCode] ")
varRate = DLookup("Rate", "Service List", "ServiceCode = [ServiceCode] ")
If (Not IsNull(varSerC)) Then Me![ServiceCode] = varSerC
If (Not IsNull(varDiag)) Then Me![Diagnosis] = varDiag
If (Not IsNull(varRate)) Then Me![Rate] = varRate

End Sub


But when the form is opened and the the ServiceCode is picked from the Combo Box, the first record is always selected and populated to the other fields. Whereas, the SerID populates correctly.

Where am I going wrong? Please look me up.

Attached Images
File Type: png Access-Service.png (21.8 KB)
Combo Box Issue

0 commentaires:

Enregistrer un commentaire

Labels