set reports recordsource at runtime
I know that you can set the recordsource of a report at runtime, using something like.
rptProject.recordsource= "Select * from Project"
however, what happens if you do not know the name of the report at design time?
I have several reports which are loaded in to a combo box. The user can then select the report to view. How then do I set the recordsource of the selected report?
What I have so far is:
VB Code:
If IsNull(cmbReports.Value) Then
MsgBox "You must select one of the reports.", vbOKOnly + vbCritical, conMsgTitle
cmbReports.SetFocus
Else 'there is a report selected
DoCmd.OpenReport cmbReports.Value, acViewPreview
End If
Thanks
Francis