Using VBA, how do I edit a report? I'm needing to edit the record source.
Thanks in advance!!
Using VBA, how do I edit a report? I'm needing to edit the record source.
Thanks in advance!!
In the Open event of report can set the RecordSource property to an SQL string. Several methods to pass the string to report.
One method is with OpenArgs. Example:
Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = Nz(Me.OpenArgs, Me.RecordSource)
End Sub
Another would be by reference to a global variable.
Another is to reference the RecordSource property of an open form.
Another is to reference a control on a form that has the SQL string.
Another alternative is just passing filter criteria to the report when it opens.
DoCmd.OpenReport "reportname", , , "ID=" & Me.tbxID
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks, I'll give that a try.