Here is how I managed to do it?
I had a common form to open for Forms, Reports and Queries.
Data came from a table.
If I needed parameters then I would open a dedicated form for those parameters (mainly start and end dates) and then run the report.
I passed any info I needed as OpenArgs.
In my tblObject I had
ObjectID
ObjectType
ObjectDescription
FormName
WhereClause
They were all brought into the combo.
HTH
Code:
Private Sub cmdOpen_Click()
' Either open a basic report/query, or open form for same with parameters
Dim strDescription As String, strName As String, strForm As String, strWhere As String
Dim iPreview As Integer
strDescription = Me.cboObject.Column(1)
strName = Me.cboObject.Column(2)
strForm = Me.cboObject.Column(3)
strWhere = Nz(cboObject.Column(4), "")
If Me.chkPreview Then
iPreview = 2 'acPreview
Else
iPreview = 0 ' aacNormal
End If
If Nz(strForm, "") = "" Then
Select Case Me.txtObjectType
Case "Report"
If strWhere = "" Then
DoCmd.OpenReport strName, iPreview, , , , strDescription
Else
DoCmd.OpenReport strName, iPreview, , strWhere, , strDescription
End If
Case "Query"
DoCmd.OpenQuery strName
Case "Form"
DoCmd.OpenForm strName
Case Else
MsgBox "Object Type not catered for"
End Select
Else
DoCmd.OpenForm strForm, , , , , , strName
End If
End Sub