I have two tables in Access; Table1 and Table2, Table2 contains an FX Rate used in a calculation in Table1. These tables would be joined on a currency field and a date. However if table2 does not have the relevant FX Rates associated with the date from Table1 the calculation will be incorrect.
I want to display a message box letting the user know this. I have tried the following code:
'Define variables
Dim msgText As String
msgText = CurrentDb.OpenRecordset("SELECT Table1.Date_of_Report, Table2.Date_of_Report FROM Table1 LEFT JOIN Table2 ON Table1.Date_of_Report = Table2.Date_of_Report GROUP BY Table1.Date_of_Report, Table2.Date_of_Report HAVING Table2.Date_of_Report Is Null ")(0).Value
MsgBox (msgText)
The above code works fine when there is only one instance with a blank date in the Table2 as it is only returning the first value. I have tried updating it ad in an additional line and change the (0) to a (1) but I get an error.
Is there a way to return a list of where all dates are blank in Table2 and display this as a message to the user?
Thanks in advance,