Run-time error ‘2471’ - The expression you entered as a query parameter produced the following error: ‘AUD’

Hello,

 

I am recieving the Run-time error '2471' when running the following code in BOLD.  The first 2 DLookups work fine, just the third DLookup is erroring out.

 

Private Sub cboCurrency_AfterUpdate()

    Me.txtNetDate = Me.cboNetDate
    Me.txtRecParty = Me.cboRecParty
    Me.Username = Me.getuser1
   
Dim dblFuncCurrency
Dim dblFuncRate
Dim dblFXRate

dblFuncCurrency = DLookup("[FuncCurrency]", "qry_GetFuncCurr", "[CompanyID] = " & Me.cboRecParty)
Me.txtFuncCurrency = dblFuncCurrency

dblFuncRate = DLookup("[FXRate]", "qry_GetFuncCurr", "[CompanyID] = " & Me.cboRecParty)
Me.TxtFuncRate = dblFuncRate

dblFXRate = DLookup("[FXRate1]", "qry_GetFxCurr", "[FuncCurrency] = " & Me.cboCurrency)
Me.txtFXRate = dblFXRate


End Sub

 

Any suggestions would be greatly appreciated.

 

-Tony

 

Question Info


Last updated September 17, 2018 Views 11,526 Applies to:
Answer
I suspect cboCurrency holds text values of currencies ? Like AUD (Australian Dollars) etc.

If this is the case the you need to put apostrophes around the matching currency

dblFXRate = DLookup("[FXRate1]", "qry_GetFxCurr", "[FuncCurrency] = '" & Me.cboCurrency & "'")

35 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.