nEBU is an individual number only used to identify the person so is never used in calculations.
Hi David,
You can skip that variable, as you can use the field-value directly:
DoCmd.OpenReport "Monthly_Invoice", acViewPreview, , "EBU_Number=" & rsInvoices!EBU_number, acHidden
The advantage of constructing dynamical sql-strings is that the report is independant of any context. Just the (complete) sql-string is transferred to the report.
Constructing becomes very easy with a few standard functions, e.g.
active_sql = "SELECT * FROM rsInvoices" _
& " WHERE EBU_Number = " & rsInvoices!EBU_Number _
& " AND StartDate >= " & As_date(Your_Startdate) _
& " AND EndDate < " & As_date(Your_Enddate + 1) _
& ... any further conditions ...
The standard function As_date converts a date to an unambigious ISO date, and surrounds the #'s.
An other standard function is As_text. This surrounds the text-value with the necessary single quotes, but also doubles the internal single qoutes.
Also, As_real: the converts the decimal comma to the necessary decimal point.
Let me know if you are interested in this way of working.
In my applications I do not use QueryDefs any more.
Imb.