Results 1 to 14 of 14
  1. #1
    serpiko is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2014
    Posts
    9

    Combo Box with Lebans Report to PDF

    Hi I have a Combo Box with the following code to the Click


    DimpROCEDURA AS String
    pROCEDuRE = ComboBox332.colum (0)
    DoCmd.OpenReport (pROCEDuRE), stLinkCriteria

    In the settings of the ComboBox item to RowSource I have the name of each report to print that if I click on that I print the report, now if I use the code to convert the Lebans Report to PDF and in the ComboBox's all there is only 1 Report fine but if I have more than 1 of this Report does not create the PDF, else I create the PDF with the First and Last Name No. of protocols and current date below I insert the code I use.


    Dim blRet As Boolean
    ' Call our convert function
    ' Please note the last param signals whether to perform
    ' font embedding or not. I have turned font embedding ON for this example.
    Me.Testo259 = Forms!Segnalazione_Registro_Infortuni!Testo259
    blRet = ConvertReportToPDF("Segnalazione Registro Infortuni", vbNullString, _


    "\\SERVER\SEGRETERIA\TRASMISSIONI\VARIE\Segnalazio ne Registro Infortuni\" & Me.Testo401 & " " & Me.Testo403 & " Prot. " & Me.Testo259 & " del " & Me.Testo408 & ".pdf", False, False, 150, "", "", 0, 0, 0)


    EDIT: Source Control = RowSource

    Thx
    Last edited by serpiko; 09-24-2014 at 05:40 AM.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe you can replace "Segnalazione Registro Infortuni" with pROCEDuRE

    blRet = ConvertReportToPDF(pROCEDuRE, vbNullString

  3. #3
    serpiko is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2014
    Posts
    9
    Quote Originally Posted by ItsMe View Post
    Maybe you can replace "Segnalazione Registro Infortuni" with pROCEDuRE

    blRet = ConvertReportToPDF(pROCEDuRE, vbNullString
    that's what I wrote is what I use on a Combo Box that has only 1 Report, instead I want to use the report to PDF on a Combo Box that has more Report

  4. #4
    serpiko is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2014
    Posts
    9
    I have done so


    DimpROCEDURA AS String
    pROCEDuRE = ComboBox332.colum (0)

    Dim blRet As Boolean
    ' Call our convert function
    ' Please note the last param signals whether to perform
    ' font embedding or not. I have turned font embedding ON for this example.
    Me.Testo259 = Forms!Segnalazione_Registro_Infortuni!Testo259
    blRet = ConvertReportToPDF(pROCEDURA, vbNullString, _
    "\\SERVER\SEGRETERIA\TRASMISSIONI\VARIE\Segnal azio ne Registro Infortuni\" & Me.Testo401 & " " & Me.Testo403 & " Prot. " & Me.Testo259 & " del " & Me.Testo408 & ".pdf", False, False, 150, "", "", 0, 0, 0)


    but does not do anything and not even an error

  5. #5
    serpiko is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2014
    Posts
    9
    Help Me pls

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You are missing a space between "Dim" and "pROCEDURA AS String"

    You are trying to declare "pROCEDURA" but assign a combo box value to "pROCEDuRE"

    And you use "pROCEDURA" (which is nothing) is the call to "ConvertReportToPDF"

    Column is misspelled: ComboBox332.colum (0) should be ComboBox332.column (0)

    The first two lines of EVERY module should be:
    Code:
    Option Compare Database
    Option Explicit
    Try this:
    Code:
    Dim blRet As Boolean
    Dim pROCEDURA AS String
    dim SaveFileName as String
    
    
    'if the bound column of ComboBox332 is 1, you don't need to use ".column(0)"
    pROCEDuRA = Me.ComboBox332.column(0) 
    
    Me.Testo259 = Forms!Segnalazione_Registro_Infortuni!Testo259
    
    SaveFileName ="\\SERVER\SEGRETERIA\TRASMISSIONI\VARIE\Segnal azio ne Registro Infortuni\" 
    SaveFileName = SaveFileName & Me.Testo401 & " " 
    SaveFileName = SaveFileName & Me.Testo403 & " Prot. "   '<- why the dot?? Bad naming convention IMO
    SaveFileName = SaveFileName & Me.Testo259 & " del " 
    SaveFileName = SaveFileName & Me.Testo408 & ".pdf"
    
    
    ' Call our convert function
    ' Please note the last param signals whether to perform
    ' font embedding or not. I have turned font embedding ON for this example.
    
    blRet = ConvertReportToPDF(pROCEDURA, vbNullString, SaveFileName, False, False, 150, "", "", 0, 0, 0)
    Single step through the code to see if the variables (pROCEDURA & SaveFileName) have the correct values.

    It would really help if you take the time to rename your controls to a meaningful name.
    Me.Testo401, Me.Testo403, ComboBox332 doesn't tell you much about the data, does it?

  7. #7
    serpiko is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2014
    Posts
    9
    Very Very Good

    Solved My Problem Thaks

  8. #8
    serpiko is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2014
    Posts
    9
    Excuse me if I wanted to help, and last put the date when I save the file as I do !?

  9. #9
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You want to add a date to the save file name?
    Something like this

    Code:
    SaveFileName ="\\SERVER\SEGRETERIA\TRASMISSIONI\VARIE\Segnal azio ne Registro Infortuni\" 
    SaveFileName = SaveFileName & Me.Testo401 & " " 
    SaveFileName = SaveFileName & Me.Testo403 & " Prot. "   '<- why the dot?? Bad naming convention IMO
    SaveFileName = SaveFileName & Me.Testo259 & " del " 
    SaveFileName = SaveFileName & Me.Testo408 & DateFieldHere 
    SaveFileName = SaveFileName & Me.Testo408 & ".pdf"

  10. #10
    serpiko is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2014
    Posts
    9
    me error variable. I confirm that I have to put in testo408 = date ()

  11. #11
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Sorry I wasn't thinking straight.

    Change to
    Code:
    SaveFileName ="\\SERVER\SEGRETERIA\TRASMISSIONI\VARIE\Segnal azio ne Registro Infortuni\" 
    SaveFileName = SaveFileName & Me.Testo401 & " " 
    SaveFileName = SaveFileName & Me.Testo403 & " Prot. "   '<- why the dot?? Bad naming convention IMO
    SaveFileName = SaveFileName & Me.Testo259 & " del " 
    SaveFileName = SaveFileName & Me.Testo408 & ".pdf"
    
    Debug.Print SaveFileName 
    Copy the line from the immediate window and show where you want the date.

  12. #12
    serpiko is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2014
    Posts
    9
    I get the date in the format mm / dd / yyyy having put in testo408 = Date $ () instead I would like to have the Italian format dd / mm / yyyy

    Thank

  13. #13
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Use the format() function to change the format when creating the new file name : Format(TheDate, "dd_mm_yyyy")

    Try change this line

    SaveFileName = SaveFileName & Me.Testo408 & ".pdf"

    to
    Code:
    SaveFileName = SaveFileName & Format(Me.Testo408, "dd_mm_yyyy") & ".pdf"

  14. #14
    serpiko is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2014
    Posts
    9
    thx very good

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

Similar Threads

  1. ogl.dll for Lebans' graphics
    By Petr Danes in forum Programming
    Replies: 22
    Last Post: 03-15-2014, 04:38 AM
  2. Lebans Continuous Forms Control Tip - In Subform
    By Whizbang in forum Programming
    Replies: 4
    Last Post: 01-16-2013, 08:17 AM
  3. Combo Box for Report
    By BLD21 in forum Reports
    Replies: 9
    Last Post: 12-06-2012, 02:52 PM
  4. Auto-size Text in Report or Form - Possibly Lebans
    By shane201980 in forum Programming
    Replies: 5
    Last Post: 10-29-2012, 12:24 PM
  5. Replies: 10
    Last Post: 01-04-2012, 01:43 PM

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