Stephanie T.
Registered User.
- Local time
- Yesterday, 16:44
- Joined
- Jun 20, 2002
- Messages
- 60
Does anyone know if it is possible to have an After_Update of one field using DLookup, look up information for two separate fields? If so, do you know how to write it?
Here is what I have that works great for the one field:
Private Sub Distributor_AfterUpdate()
On Error GoTo Err_Distributor_AfterUpdate
Dim strFilter As String
' Evaluate filter before it's passed to DLookup function.
strFilter = "Distributor = '" & Me!Distributor & "'"
' Look up Distributors's Spoilage and assign it to Spoilage control.
Me!Spoilage = DLookup("Spoilage", "tblDistributors", strFilter)
Exit_Distributor_AfterUpdate:
Exit Sub
Err_Distributor_AfterUpdate:
MsgBox Err.Description
Resume Exit_Distributor_AfterUpdate
End Sub
I'd also like to us this function to control the "FreightAllowance" field as well as the "Spoilage" field.
Your help is great appreciated.
Thanks,
Stephanie
Here is what I have that works great for the one field:
Private Sub Distributor_AfterUpdate()
On Error GoTo Err_Distributor_AfterUpdate
Dim strFilter As String
' Evaluate filter before it's passed to DLookup function.
strFilter = "Distributor = '" & Me!Distributor & "'"
' Look up Distributors's Spoilage and assign it to Spoilage control.
Me!Spoilage = DLookup("Spoilage", "tblDistributors", strFilter)
Exit_Distributor_AfterUpdate:
Exit Sub
Err_Distributor_AfterUpdate:
MsgBox Err.Description
Resume Exit_Distributor_AfterUpdate
End Sub
I'd also like to us this function to control the "FreightAllowance" field as well as the "Spoilage" field.
Your help is great appreciated.
Thanks,
Stephanie