Solved

Report to SnapShot with Where

Posted on 2008-10-18
8
290 Views
Last Modified: 2012-05-05
I have a report that is being used two different ways:
1)  DoCmd.OpenReport strReport, acViewPreview, , "ActionID = " & ActionID
2)  An procedure that will loop through a recordset and open the same report but within each loop the single ActionID needs to be saved as a PDF and emailed, so I was going to use Leban's SnapshotToPDF routine.  But I can't figure out how to make individual Snapshots using a 'where parameter'
0
Comment
Question by:UniqueData
  • 4
  • 3
8 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
Can we concentrate on the PDF portion of this question?

The emailing bit requires a different process.
(Should be a new question)

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
Can you post your code so we do not have to recreate it?
0
 
LVL 18

Expert Comment

by:jmoss111
Comment Utility
UniqueData,

Something like the attached snip should work for you.

Jim
Dim x As Long

'Dim blRet As Boolean

Dim sPDF As String

Dim sName As String

Dim fso As New Scripting.FileSystemObject

Dim fil As Scripting.File

          Dim strRootFol As String

          Dim strDestFol As String

          Dim fol As Scripting.Folder

strRootFol = "R:\FTP\"

sName = strRootFol

Set fol = fso.GetFolder(strRootFol)
 

If Len(sName & vbNullString) = 0 Then Exit Sub

' let's use the name of the selected Snapshot file

' to name our converted PDF document.

For Each fil In fol.Files

	If fil Like "*" & ".snp" Then
 

		

		

			sPDF = Mid(sName, 1, Len(sName) - 4)
 

			ConvertReportToPDF(vbNullString, sName, sPDF & x & ".PDF", False, True, 0, "", "", 0, 1)

		Else

	End If

Next fil	    	

Open in new window

0
 
LVL 7

Author Comment

by:UniqueData
Comment Utility
sorry, i am fine with the pdf creation and emailing.  I am having an issue of how to create a snapshot report for a specific record.  I don't see a 'where parameter' in the syntax of saving as a snapshot.  And I can't make the report's recordsource look at a specific field to filter on because the report is called by two different forms for two different purposes.


0
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
Comment Utility
UniqueData,

You have to open the report with the WHERE  clause and specify the "Hidden" argument.

Something like this, as an example, depending on your needs.

Dim strReportName As String
strReportName = "Batch"

    DoCmd.OpenReport strReportName, acPreview, , "ProviderInfo='Networkcar'", acHidden
    DoCmd.OutputTo acOutputReport, strReportName, acFormatSNP, "C:\Temp\" & strReportName & ".snp"
    DoCmd.Close acReport, strReportName

So, basically, you have to, in one war or another, ...open the report with the WHERE clause then save it as a snapshot while it is still open.

I am sure a memeber like you can adapt this to work in your database.

JeffCoachman
0
 
LVL 7

Author Comment

by:UniqueData
Comment Utility
ahh, perfect.

I didn't know the Output to and Open as hidden worked together like that.

Thanks

0
 
LVL 7

Author Closing Comment

by:UniqueData
Comment Utility
snapshot where
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
;-)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now