J
johnlute
Good day! I'm trying to employ Stephen Lebans' ReportToPDF design.
It's a nifty thing but I'm a bit stuck. I need to throw a where clause
into the following click event:
Private Sub cmdReportToPDF_Click()
Dim i As Integer
Dim strForm As String
For i = 1 To CurrentProject.AllForms.Count
If CurrentProject.AllForms(i - 1).IsLoaded Then
strForm = CurrentProject.AllForms(i - 1).Name
If strForm <> "Marzetti Main Menu" Then
DoCmd.Close acForm, strForm, acSaveNo
End If
End If
Next i
Dim blRet As Boolean
blRet = ConvertReportToPDF(Me.cbSelectReport, vbNullString, _
Me.cbSelectReport.Value & ".pdf", False, True, 150, "", "", 0, 0, 0)
End Sub
The where clause is:
Dim strWhere As String
strWhere = "[txtProfileID] = """ & _
Forms![Marzetti Main Menu].Form![txtProfileID] & """"
DoCmd.OpenReport Me!cbSelectReport, acNormal _
, , strWhere
I just can't get the where clause into the code without an error being
created. I think I may be trying to do the impossible...? Is it
possible to filter this with a where clause? I've adjusted a test
report to filter accordingly however the database is designed so that
the report can be run from other forms therefore if I "have" to go
this route I'll need to eliminate that feature and force all reports
to be opened from the Main Menu. I don't want to do that!
Your help is greatly appreciated!
It's a nifty thing but I'm a bit stuck. I need to throw a where clause
into the following click event:
Private Sub cmdReportToPDF_Click()
Dim i As Integer
Dim strForm As String
For i = 1 To CurrentProject.AllForms.Count
If CurrentProject.AllForms(i - 1).IsLoaded Then
strForm = CurrentProject.AllForms(i - 1).Name
If strForm <> "Marzetti Main Menu" Then
DoCmd.Close acForm, strForm, acSaveNo
End If
End If
Next i
Dim blRet As Boolean
blRet = ConvertReportToPDF(Me.cbSelectReport, vbNullString, _
Me.cbSelectReport.Value & ".pdf", False, True, 150, "", "", 0, 0, 0)
End Sub
The where clause is:
Dim strWhere As String
strWhere = "[txtProfileID] = """ & _
Forms![Marzetti Main Menu].Form![txtProfileID] & """"
DoCmd.OpenReport Me!cbSelectReport, acNormal _
, , strWhere
I just can't get the where clause into the code without an error being
created. I think I may be trying to do the impossible...? Is it
possible to filter this with a where clause? I've adjusted a test
report to filter accordingly however the database is designed so that
the report can be run from other forms therefore if I "have" to go
this route I'll need to eliminate that feature and force all reports
to be opened from the Main Menu. I don't want to do that!
Your help is greatly appreciated!