Re: Creating Single Snapshot Files for Multiple Records

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Debbilynn,

Yes, it is possible.  Here is an example of one approach...

Let's suppose the Record Source of your report is a query named MyQuery. This query selects the records based on the ticks in the checkbox, and it sounds like you already have that part sorted. And we also assume that there is an ID field or some such in the query, and hence the report, so let's suppose this field is called MyPK.

Ok, so let's open a Recordset based on the records to be outputted, and loop through one by one, and each time assign the ID into the Where clause of the report's query. So the code will look something like this...

Dim rst As DAO.Recordset
Dim qdf As DAO.Querydef
Dim BaseSQL As String
Dim strSQL As String
Set rst = CurrentDb.OpenRecordset("SELECT MyPK FROM MyQuery")
Set qdf = CurrentDb.QueryDefs("MyQuery")
BaseSQL = Left(qdf.SQL, Len(qdf.SQL)-3)
With rst
Do Until .EOF
strSQL = BaseSQL & " AND (MyPK=" & ![MyPK] & ")"
qdf.SQL = strSQL
DoCmd.OutputTo acOutputReport, "YourReport", "SnapshotFormat", ![MyPK] & ".snp"
.MoveNext
Loop
.Close
End With
qdf.SQL = BaseSQL
Set qdf = Nothing
Set rst = Nothing


Well, I have made a few assumptions here, but I hope you might get the general idea.

--
Steve Schapel, Microsoft Access MVP


Debbilynn wrote:
I have a form based off a workload table. Once a specific task is completed, a checkbox is marked yes then a report is created and saved in a snapshot format. Each snapshot is given a specific name for identification purposes.

As things stand, we cannot check several items off then create the snapshots because it places the snapshots into one multiple-record snapshot file, which creates more headaches than I want to explain.

Is there a way to code Access 2002 to create a single snapshot file per record for several records at a time? My VB knowledge is pretty limited in that I am still a beginner.

Thank you for any help you can give, even if the answer is "no." At least then I will stop wasting my time searching the web.
.



Relevant Pages

  • RE: Multiply qty of filtered records
    ... If you should want to try doing this with a query (which is probably the more ... etc in the bottom part of the design view. ... I do know how to get this information in a Report, ... Dim rs As DAO.Recordset ...
    (microsoft.public.access.modulesdaovba)
  • Re: Report has 126 pages and take forever to run
    ... The query runs in 1 second, but the report still takes 25 seconds. ... Dim intCount As Integer ...
    (microsoft.public.access.reports)
  • RE: vary report label caption using form & table info
    ... a template for the label/envelope....which would be driven off the same query. ... Command button on the form opens the report "template. ... The label caption has 3 placeholders. ... Dim StartToken As Long ...
    (microsoft.public.access.reports)
  • RE: Need help with Code Please!!!
    ... MsgBox "The qryCompany\USFNumber query returned no records?", ... vbCritical, "NOTHING TO REPORT" ... Dim qd As QueryDef 'object ref to query item ... Dim myDataSource As String ...
    (microsoft.public.access.formscoding)
  • Re: Force Blank Lines
    ... I used your sugestion and I am not getting what I am ... I have a report with vb ... Dim lngDuration As Long 'Length of Usage ... Create a query based on: ...
    (microsoft.public.access.reports)