Question

Q: Run-time error ‘2471’ - The expression you entered as a query parameter produced the following error: ‘AUD’ This thread is locked from future replies

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

Answer

A:

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 & "'")

Did this solve your problem?

Sorry this didn't help.

28 people were helped by this reply



 
Question Info

Views: 10,198 Last updated: April 20, 2018 Applies to: