I have a Union query with invoice data like invoice number, supplier and so on. This query is created for the purpose of providing credit note information.
My problem arise when I would like to provide exchange rate for invoices in different currencies. If there is for example RON currency, I need to check currency and date of invoice and then provide value from another table.
I stored currencies and their values in another database. I wanted to use Dlookup function but it works only current database. Not sure what can I do. Is VBA needed here or it can be avoided?
Edit: Having problem with syntax:
Query:
SELECT [Faktury].InvoiceNumber, [Faktury].InvoiceDate, [Faktury].InvoiceCountry, [Faktury].Currency, DLookUp("Value","Tabela1","Currency1 =" & [Currency]) AS Wyr1
FROM [Faktury];
Dlookup syntax:
DLookUp("Value";"Tabela1";"Currency1 =" & [Currency])
Query has column with Currency
used in invoice and Tabela1
has Currency1
and Value
. I get error or no value is shown...
DLookUp
, in VBA? And what is the query you are referring to that contains the column currency? – agoldDLookUp
here, just use use 'Tabela1' as a normal table in the query. – agold