G
Guest
I am having trouble with the following
Private Function Calculate_Charges()
Call Lookup_Charges
TransType = Me!TransType
PolType = Me!PolType
SdRateNow = DLookup("[SD]", "[TblCharges]", "[Class] = [PolType] and
_[TransType] = [TransType]")
ICLRateNow = DLookup("[ICL]", "[TblCharges]", "[Class] = [PolType]")
GSTRateNow = DLookup("[GST]", "[TblCharges]", "[Class] = [PolType]")
Me!SD.Value = SdRateNow
Me!ICL.Value = (Me!Premium * ICLRateNow) / 100
Me!GST.Value = ((Me!Premium + Me!SD) * GSTRateNow) / 100
Me!GSTFee.Value = ((Me!BrokerFee) * GSTRateNow) / 100
Me!GSTBrokerage.Value = (Me!Brokerage * GSTRateNow) / 100
End Function
Call LookupCharges is a public function which declares all the variables
I use this on an open form action. The SdrateNow Lookup only finds the first
record in the table based on the [Class] = [PolType] criteria and ignores the
[TransType] = [TransType] criteria. [TransType] is text both on the form and
in the table.
I think I have the syntax wrong but cannot seem to get right.
Would appreciate any help.
Thanks
David
Private Function Calculate_Charges()
Call Lookup_Charges
TransType = Me!TransType
PolType = Me!PolType
SdRateNow = DLookup("[SD]", "[TblCharges]", "[Class] = [PolType] and
_[TransType] = [TransType]")
ICLRateNow = DLookup("[ICL]", "[TblCharges]", "[Class] = [PolType]")
GSTRateNow = DLookup("[GST]", "[TblCharges]", "[Class] = [PolType]")
Me!SD.Value = SdRateNow
Me!ICL.Value = (Me!Premium * ICLRateNow) / 100
Me!GST.Value = ((Me!Premium + Me!SD) * GSTRateNow) / 100
Me!GSTFee.Value = ((Me!BrokerFee) * GSTRateNow) / 100
Me!GSTBrokerage.Value = (Me!Brokerage * GSTRateNow) / 100
End Function
Call LookupCharges is a public function which declares all the variables
I use this on an open form action. The SdrateNow Lookup only finds the first
record in the table based on the [Class] = [PolType] criteria and ignores the
[TransType] = [TransType] criteria. [TransType] is text both on the form and
in the table.
I think I have the syntax wrong but cannot seem to get right.
Would appreciate any help.
Thanks
David