Results 1 to 2 of 2
  1. #1
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276

    Auto Serial Number To Add On PDF Output File

    I have the following code when a pdf file is generated it replaces the older file where as I want a auto serial number to be added so the older file is not replaced. How can I do that.

    Private Sub Command19_Click()
    On Error GoTo Err_Handler



    Const ReportName = "General Sales"
    Const MESSAGETEXT = "No customer selected."
    Dim strCriteria As String

    ' build string expression to filter report
    ' to selected customer
    strCriteria = "CoId = " & Me.cboCustomers


    ' make sure a customer is selected
    If Not IsNull(Me.cboCustomers) Then
    ' open report filtered to selected customer
    DoCmd.OpenReport ReportName, _
    View:=acViewPreview, _
    WhereCondition:=strCriteria









    DoCmd.OutputTo ObjectType:=acOutputReport, ObjectName:="General Sales", OutputFormat:=acFormatPDF, Outputfile:="C:\Users\Filtech\Desktop\PDF Reports\AC-Title Sales" & " " & Format(Date, "dd-mmm-yyyy") & ".PDF"



    Else
    MsgBox MESSAGETEXT, vbExclamation, "Invalid operation"
    End If

    Exit_Here:
    Exit Sub

    Err_Handler:
    MsgBox Err.Description, vbExclamation, "Error"
    Resume Exit_Here

    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Save serial number to table so code can pull last number used and increment by 1 and then save that new value back to table.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 11-07-2017, 06:53 PM
  2. Replies: 5
    Last Post: 03-15-2016, 11:49 AM
  3. Replies: 1
    Last Post: 10-25-2013, 03:38 PM
  4. auto fill name based on file number
    By mark_w in forum Forms
    Replies: 13
    Last Post: 08-03-2012, 04:59 AM
  5. Auto Sequence String Serial Number
    By eddyc99 in forum Programming
    Replies: 2
    Last Post: 10-02-2009, 08:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums