Results 1 to 4 of 4

Thread: Print

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    a place called home
    Posts
    64

    Print

    Dear friends,

    I've got a problem, ... again. I'm working on this application, in wich I need to create an order. On an order, you must see data from several tables out of my database. For example, an order contains information about the company who delivers the goods, about the articles on the order, the delivery address, ... all from different tables.

    So I liked to print the screen where I select all this data, but it doesn't looked like I wanted it, when I printed it. So I tried to use rich textboxes and get all this data from all these queries in a rich textboxe, but my lay out really sucked and I couldn't get it good.

    The question is: 'How should I work to get my order on paper?' and 'Have you got an example of it somewhere on the net?'
    A good programmer is a LAZY programmer!

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Print

    You could use the Data Report.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3
    Fanatic Member
    Join Date
    Dec 2003
    Posts
    509

    Re: Print

    Are you using this on a computer that has Microsoft Word?

    You could just try transfering the items from the database to Word bookmarks. It will keep a really constant look to it. You just have to set up the bookmarks once. Change the extention to dot instead of doc and you have a template that you can use over and over again.

    You can then transfer items from several different databases into 1.

    Here is an example of what i did. You could adjust it to yours if you want to go that route. Remember to select your references if you want to go that way.

    VB Code:
    1. Public Sub printinvoice()
    2.    
    3.    Set objwdapp = New Word.Application
    4.  
    5.    If FrmInvoice.txtinvoicetype.Text = "SI" Then
    6.       Set objwddoc = objwdapp.Documents.Add("\\S2\web\software\invoice\Final\Invoice.dot")
    7.    ElseIf FrmInvoice.txtinvoicetype.Text = "SC" Then
    8.       Set objwddoc = objwdapp.Documents.Add("\\S2\web\software\invoice\Final\CreditNote.dot")
    9.    End If
    10.  
    11.    objwdapp.Visible = False
    12.  
    13.    If FrmInvoice.txtaddress2Sl.Text <> "" And FrmInvoice.txtaddress3sl.Text = "" And FrmInvoice.txtaddress4sl.Text = "" Then
    14.       objwddoc.Bookmarks("Address2").Range = FrmInvoice.txtaddress2Sl.Text
    15.       objwddoc.Bookmarks("Postcode").Range = FrmInvoice.txtPostcode.Text
    16.    ElseIf FrmInvoice.txtaddress2Sl.Text = "" And FrmInvoice.txtaddress3sl.Text <> "" And FrmInvoice.txtaddress4sl.Text = "" Then
    17.       objwddoc.Bookmarks("Address2").Range = FrmInvoice.txtaddress3sl.Text
    18.       objwddoc.Bookmarks("Address3").Range = FrmInvoice.txtPostcode.Text
    19.    ElseIf FrmInvoice.txtaddress2Sl.Text = "" And FrmInvoice.txtaddress3sl.Text = "" And FrmInvoice.txtaddress4sl.Text <> "" Then
    20.       objwddoc.Bookmarks("Address2").Range = FrmInvoice.txtaddress4sl.Text
    21.       objwddoc.Bookmarks("Address3").Range = FrmInvoice.txtPostcode.Text
    22.    ElseIf FrmInvoice.txtaddress3sl.Text <> "" And FrmInvoice.txtaddress3sl.Text <> "" And FrmInvoice.txtaddress4sl.Text = "" Then
    23.       objwddoc.Bookmarks("Address2").Range = FrmInvoice.txtaddress2Sl.Text
    24.       objwddoc.Bookmarks("Address3").Range = FrmInvoice.txtaddress3sl.Text
    25.       objwddoc.Bookmarks("Address4").Range = FrmInvoice.txtPostcode.Text
    26.    ElseIf FrmInvoice.txtaddress2Sl.Text = "" And FrmInvoice.txtaddress3sl.Text <> "" And FrmInvoice.txtaddress4sl.Text <> "" Then
    27.       objwddoc.Bookmarks("Address2").Range = FrmInvoice.txtaddress3sl.Text
    28.       objwddoc.Bookmarks("Address3").Range = FrmInvoice.txtaddress4sl.Text
    29.       objwddoc.Bookmarks("Address4").Range = FrmInvoice.txtPostcode.Text
    30.    ElseIf FrmInvoice.txtaddress2Sl.Text <> "" And FrmInvoice.txtaddress3sl.Text = "" And FrmInvoice.txtaddress4sl.Text <> "" Then
    31.       objwddoc.Bookmarks("Address2").Range = FrmInvoice.txtaddress2Sl.Text
    32.       objwddoc.Bookmarks("Address3").Range = FrmInvoice.txtaddress4sl.Text
    33.       objwddoc.Bookmarks("Address4").Range = FrmInvoice.txtPostcode.Text
    34.    ElseIf FrmInvoice.txtaddress2Sl.Text <> "" And FrmInvoice.txtaddress3sl.Text <> "" And FrmInvoice.txtaddress4sl.Text <> "" Then
    35.       objwddoc.Bookmarks("Address2").Range = FrmInvoice.txtaddress2Sl.Text
    36.       objwddoc.Bookmarks("Address3").Range = FrmInvoice.txtaddress3sl.Text
    37.       objwddoc.Bookmarks("Address4").Range = FrmInvoice.txtaddress4sl.Text
    38.       objwddoc.Bookmarks("Postcode").Range = FrmInvoice.txtPostcode.Text
    39.    ElseIf FrmInvoice.txtaddress2Sl.Text <> "" And FrmInvoice.txtaddress3sl.Text = "" And FrmInvoice.txtaddress4sl.Text = "" Then
    40.       objwddoc.Bookmarks("Address2").Range = FrmInvoice.txtaddress2Sl.Text
    41.       objwddoc.Bookmarks("Postcode").Range = FrmInvoice.txtPostcode.Text
    42.    End If
    43.    'Call wordcheck
    44.  
    45.    objwddoc.Bookmarks("InvoiceNo").Range = FrmInvoice.txtInvoiceNo.Text
    46.    objwddoc.Bookmarks("Date").Range = Format(FrmInvoice.txtDate, "dd mmmm yyyy")
    47.    objwddoc.Bookmarks("CustomerName").Range = FrmInvoice.txtcustomer.Text
    48.    objwddoc.Bookmarks("CompanyName").Range = FrmInvoice.dbnamesl.Text
    49.    objwddoc.Bookmarks("Address1").Range = FrmInvoice.txtaddress1Sl.Text
    50.    objwddoc.Bookmarks("Description1").Range = FrmInvoice.txtDescription1sl.Text
    51.    'Call first5
    52.  
    53.    objwddoc.Bookmarks("Description6").Range = FrmInvoice.txtDescription6sl.Text
    54.    'Call second5
    55.  
    56.  
    57.    objwddoc.Bookmarks("Description11").Range = FrmInvoice.txtDescription10sl.Text
    58.    'Call third5
    59.  
    60.    objwddoc.PrintOut
    61.   Do While objwdapp.BackgroundPrintingStatus > 0
    62.    
    63.       DoEvents
    64.    Loop
    65.    
    66.    objwdapp.Quit (wdDoNotSaveChanges)
    67.    Set objwdapp = Nothing
    68.    FrmInvoice.Refresh
    69.  
    70. End Sub

  4. #4
    Fanatic Member
    Join Date
    Dec 2003
    Posts
    509

    Re: Print

    Change where i have put txtaddress1 etc to something like r![name]

    From your recordset.

Posting Permissions

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



Click Here to Expand Forum to Full Width