I have an MS Access Report with Unbound Text Boxes. I have code that creates SQL Queries, stores them in array arguments (such as arr(1) as seen below) and then assigns the RESULT of that query to the text box for display on my Access report.
The following working line of code does this:
Me.Header0TextBox3.Control
Source = "=" & CurrentDB.OpenRecordset(ar
r(1)).Fiel
ds(0).Valu
e
My question is that SOMETIMES the query that is stored in arr(1) returns NO Records, which is OK EXCEPT for the fact that if the Query returns no records and I attempt to assign the result of this query as above, I get a code violation.
I need to FIRST check that the resulting query stored in arr(1) returns something BEFORE I execute the above line of code.
Does anyone know how to do this?
Start Free Trial