Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    5

    Unanswered: Simple report question

    what would be the proper script to generate a report from the current record being viewed on a form?

    The next question: is there a code to automatically export that report to a snapshot file?

    Thanks for your help!

  2. #2
    Join Date
    Jun 2002
    Location
    Vienna, VA
    Posts
    53
    Hope the below is understandable -- Leah

    1) Generate report showing current record only

    Private Sub cmdShowReport_Click()
    DoCmd.OpenReport "rptDetails", acViewPreview, , "[RecordID] = '" & Me.RecordID & "'"
    End Sub

    '-- note I'm using a text based record ID, remove the single quotes if record ID is numeric

    2) Export to snapshot on open

    In the report:

    Private Sub Report_Activate()
    '--Creates snapshot file

    Dim snapFile As String
    Dim reportOpen As Boolean

    strCurrentBarcode = Me.Barcode

    snapFile = CurrentDBDir & "V400" & ".snp" '-- file path
    reportOpen = makeSnapShot_FX(Me.Name, snapFile)

    End Sub

    '-- in code module (modUtilities)

    Public Function makeSnapShot_FX(ReportName As String, snapFilePath As String) As Boolean
    '-- creates snapshot - overwriting existing file name without prompt. Does not
    '-- open Snapshot viewer

    DoEvents
    DoCmd.OutputTo acOutputReport, ReportName, "Snapshot Format (*.snp)", snapFilePath


    End Function

  3. #3
    Join Date
    Oct 2003
    Posts
    5
    Ok, everything is working sorta...just a few clean up questions

    I am unsure as to what this lines purpose is. I've play around with it to no avail.
    strCurrentBarcode = Me.Barcode

    Now, I've got the report creating the snapshot, but it seems to snapshot the entire database. Any suggestions here?

    Do I need to alter the "Name" in the following line any?
    reportOpen = makeSnapShot_FX(Me.Name, snapFile)

    Thanks for the help, obviously I'm rather new at this, but learning lots from ya.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •