S
sunflower
Help on Fill Fields automatically
tblCONTACTS
FieldName Data Type
ContactID AutoNumber
Name Text
Phone Text
DepartmentNo Number
tblDEPTS
FieldName Data Type
DEPTID AutoNumber
DepartmentName Text
DepartmentNo Number
tblWORKORDER
FieldName Data Type
WOID AutoNumber
DEPTID Number
Requestor Text
Phone Text
On a form, on a Combo box control named “Requester”
I have the following event procedure:
Sub Requestor_Exit(Cancel As Integer)
Dim varPhone, varDEPTID As Variant
varPhone = DLookup("Phone", "tblCONTACTS", "Phone =[Phone] ")
varDEPTID = DLookup("DEPTID ", "tblDEPTS", "DEPTID =[ DEPTID] ")
If (Not IsNull(varPhone)) Then Me![Phone] = varPhone
If (Not IsNull(varDEPTID)) Then Me![DEPTID] = varDEPTID
End Sub
On exit, it fills both the Text boxes “Phone” and “DEPTID”…
WITH THE FIRST RECORD OF THE TABLES!!!
How do I get it to match the Requestor record?
any help is grealy appreciated
tblCONTACTS
FieldName Data Type
ContactID AutoNumber
Name Text
Phone Text
DepartmentNo Number
tblDEPTS
FieldName Data Type
DEPTID AutoNumber
DepartmentName Text
DepartmentNo Number
tblWORKORDER
FieldName Data Type
WOID AutoNumber
DEPTID Number
Requestor Text
Phone Text
On a form, on a Combo box control named “Requester”
I have the following event procedure:
Sub Requestor_Exit(Cancel As Integer)
Dim varPhone, varDEPTID As Variant
varPhone = DLookup("Phone", "tblCONTACTS", "Phone =[Phone] ")
varDEPTID = DLookup("DEPTID ", "tblDEPTS", "DEPTID =[ DEPTID] ")
If (Not IsNull(varPhone)) Then Me![Phone] = varPhone
If (Not IsNull(varDEPTID)) Then Me![DEPTID] = varDEPTID
End Sub
On exit, it fills both the Text boxes “Phone” and “DEPTID”…
WITH THE FIRST RECORD OF THE TABLES!!!
How do I get it to match the Requestor record?
any help is grealy appreciated