I am trying to perform a lookup which is returning an error - attached.
I have a bound text box on the form called RatingNCB, I also have an unbound text box called SILookup on the form as well. SILookup is populated depending on a value entered into another field on the form. This part is working justfine.
I am trying to perform a lookup in a table (attached excek spreadsheet) that uses the value of the RatingNCB field on the form as the column reference or lookup and the SILookup as the criteria or row reference.
For example - if RatingNCB on the form = Rating1 and SILookup on the form = 3, then it should return $3,750.00 but is returning an error instead.
I have a suspicion it is something to do with the syntax, but nothing I try is working.
Any assistance would be greatly appreciated.
[imgnothumb]http://bytes.com/attachments/attachment/6833d1358134695/dlookup-error.jpg[/imgnothumb]
I have a bound text box on the form called RatingNCB, I also have an unbound text box called SILookup on the form as well. SILookup is populated depending on a value entered into another field on the form. This part is working justfine.
I am trying to perform a lookup in a table (attached excek spreadsheet) that uses the value of the RatingNCB field on the form as the column reference or lookup and the SILookup as the criteria or row reference.
For example - if RatingNCB on the form = Rating1 and SILookup on the form = 3, then it should return $3,750.00 but is returning an error instead.
I have a suspicion it is something to do with the syntax, but nothing I try is working.
Any assistance would be greatly appreciated.
Code:
Sub CalcPremium() Dim RatingCode As String RatingCode = "[" & Me.[RatingNCB] & "]" Forms!frm_Individual!LookupPrem.Value = dlookup(RatingCode, "tbl_Rates", "ID=Forms!Frm_individual!SILookup") End Sub
Comment