Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Print report... (2000 sr 1)

    Hi Hans,
    still on indirizzario userform....;-)
    I have attached one xls file and img.
    In effect is possible to insert a button on this userform and print a report of actually record is show(mke that only if in txtbox21 is present a value "55")?
    As usual tks, for ever naturally.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Print report... (2000 sr 1)

    I thought your project was finished?

    Set the ControlSource property of the text boxes on the form to the corresponding cells in the report sheet. Let's say that you name the report sheet Report. The ControlSource of TextBox2 on the Indirizzario form would be Report!D5 if you use the layout from the workbook you attached.

    The On Click event procedure of the command button could look like this:

    Private Sub cmdReport_Click()
    If Me.TextBox21 = "55" Then
    Worksheets("Report").PrintOut
    Else
    Beep
    End If
    End Sub

    In this example, cmdReport is the name of the command button.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print report... (2000 sr 1)

    For this:
    I thought your project was finished?
    ....92%
    8% is for print report;-)
    ... but i must insert the sheet Report in the principal Wbook?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Print report... (2000 sr 1)

    > but i must insert the sheet Report in the principal Wbook?

    Yes, otherwise it is much more work. If you like, you can hide the worksheet, and only make it visible while printing:

    Private Sub cmdReport_Click()
    If Me.TextBox21 = "55" Then
    Application.ScreenUpdating = False
    With Worksheets("Report")
    .Visible = True
    .PrintOut
    .Visible = False
    End With
    Application.ScreenUpdating = False
    Else
    Beep
    End If
    End Sub

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print report... (2000 sr 1)

    OH, OH...
    not all txtbox fill the sheet report.
    If i insert the range report!d17 in controllsource of textbox9 the value in the userform, is cleared...
    i post the zip of userform

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Print report... (2000 sr 1)

    That is to be expected, but when you open the form, or use the scroll bar, all text boxes should be filled by the code behind your form.

  7. #7
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print report... (2000 sr 1)

    Yes...
    I have attached my userform...

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Print report... (2000 sr 1)

    I saw that. It doesn't alter my reply.

  9. #9
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print report... (2000 sr 1)

    ... not completly understand your reply:-(

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Print report... (2000 sr 1)

    When you set the ControlSource of a text box on a form to a cell in a worksheet, the contents of the text box will be made equal to the value of the cell. If the cell happens to be empty, the text box will be cleared. From that moment, a change in the text in the text box will also change the value of the cell, and a change in the value of the cell will also change the text in the text box.
    Your form has code in the On Activate event of the form and in the On Change event of the scroll bar to fill the text boxes. This will automatically fill the cells in the Report sheet too.

  11. #11
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print report... (2000 sr 1)

    Hans, good mornig...
    Peraphs i have solved?! in every event change of txt box i have insert this:
    example for txtbox14
    Worksheets("REPORT").Range("J29") = TextBox14.Value
    And during the scroll is perfect and show thw value correctly and oriont the report FINE!!!!!
    Is a good way.
    You have started me with your suggestion and i have choice the other way...
    Tks as usul for patience

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Print report... (2000 sr 1)

    It's fine if it works for you.

  13. #13
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print report... (2000 sr 1)

    99%
    ;-)

  14. #14
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print report... (2000 sr 1)

    But, sorry, wath is BEEP?

  15. #15
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Print report... (2000 sr 1)

    Beep produces a warning sound. If the user clicks the Report button while TextBox21 does not contain "55", he/she will hear the beep. I put it in the Else part of the code as a placeholder, to be replaced with real code by you if necessary, for example

    MsgBox "Report not possible"

    If you don't want to do anything if TextBox21 does not contain "55", you can delete the line with Beep.

Page 1 of 2 12 LastLast

Posting Permissions

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