Solved

Report to SnapShot with Where

Posted on 2008-10-18
8
297 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22750680
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
ID: 22750694
Can you post your code so we do not have to recreate it?
0
 
LVL 18

Expert Comment

by:jmoss111
ID: 22750780
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Author Comment

by:UniqueData
ID: 22755398
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
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 22758359
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
ID: 22760712
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
ID: 31507505
snapshot where
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22764593
;-)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

696 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