I have used the DLookup function many times in VBA, but I am trying to use it in a slightly different manner this time and I can't figure out wheat I am missing.
I have a table called MarketRates, it has 2 fields; CCode and Rates
I have a form that I want to look up the rate based on the code and enter it in the box.
Here is my code based on button click
There error I get is syntax error, missing operator.
If I write it like this:
It doesn't return the value thats in the rates column, just blank.
I have a table called MarketRates, it has 2 fields; CCode and Rates
I have a form that I want to look up the rate based on the code and enter it in the box.
Here is my code based on button click
Code:
Private Sub CalcRate_Click()
Me.SADM20 = DLookup("[Rate]", "MarketRates", "CCode=" & (SADM20))
End Sub
If I write it like this:
Code:
Private Sub CalcRate_Click()
Me.SADM20 = DLookup("[Rate]", "MarketRates", "CCode=SADM20")
End Sub