Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98

    Question Unanswered: HELP! Print report for the current formno.

    Hi guys,

    I have a form an I have a report. Now I want to place a button on the form which opens the report ONLY for the number of the form where the user is looking. After that I want it to print the report and all of this has to happen without the user seeing it. IS THAT POSSIBLE?

    I would be so grateful for any help I can get.

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: HELP! Print report for the current formno.

    Originally posted by charlottevk
    Hi guys,

    I have a form an I have a report. Now I want to place a button on the form which opens the report ONLY for the number of the form where the user is looking. After that I want it to print the report and all of this has to happen without the user seeing it. IS THAT POSSIBLE?

    I would be so grateful for any help I can get.
    You mean you want to open the Repot to show only one record yes?
    If so suppose you have a field on yur Form called txt_id which contains the idNumber, and the field in the table is called ID, and your form is called F_Input
    then put a Button and put the next code in its onClick event

    DoCmd.OpenReport "yourFormName", acViewPreview, , "[ID]=forms!F_Input!txt_id"

    Hope that helps you. Good luck

  3. #3
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85

    Re: HELP! Print report for the current formno.

    Originally posted by hammbakka
    You mean you want to open the Repot to show only one record yes?
    If so suppose you have a field on yur Form called txt_id which contains the idNumber, and the field in the table is called ID, and your form is called F_Input
    then put a Button and put the next code in its onClick event

    DoCmd.OpenReport "yourFormName", acViewPreview, , "[ID]=forms!F_Input!txt_id"

    Hope that helps you. Good luck
    replace acViewPreview with acViewNormal otherwise the user is seeing it.
    Don't forget that with a new entry you have to give a Me.Refresh first

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: HELP! Print report for the current formno.

    Originally posted by lodewijk
    replace acViewPreview with acViewNormal otherwise the user is seeing it.
    Don't forget that with a new entry you have to give a Me.Refresh first
    Thanks for completing the answer.

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: HELP! Print report for the current formno.

    Originally posted by hammbakka
    You mean you want to open the Repot to show only one record yes?
    If so suppose you have a field on yur Form called txt_id which contains the idNumber, and the field in the table is called ID, and your form is called F_Input
    then put a Button and put the next code in its onClick event

    DoCmd.OpenReport "yourFormName", acViewPreview, , "[ID]=forms!F_Input!txt_id"

    Hope that helps you. Good luck

    Opening the Report in acViewNormal will send the content of the Report to the printer directly, without showing the report on the screen

    DoCmd.OpenReport "yourFormName", [Color blue]acViewNormal [/Color], , "[ID]=forms!F_Input!txt_id"

  6. #6
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85

    Re: HELP! Print report for the current formno.

    Originally posted by hammbakka
    Opening the Report in acViewNormal will send the content of the Report to the printer directly, without showing the report on the screen

    DoCmd.OpenReport "yourFormName", [Color blue]acViewNormal [/Color], , "[ID]=forms!F_Input!txt_id"
    That is the difference between a guru and a memebr

  7. #7
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98

    Re: HELP! Print report for the current formno.

    THANKYOU! I am going to try it out immediately. You guys are great!

  8. #8
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98

    One little problem

    It works! Thankyou so much. I do have one little problem and that is when I cancel the print screen I get a message saying something went wrong. How can I make sure this message doesn;t show?

  9. #9
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85

    Re: One little problem

    Originally posted by charlottevk
    It works! Thankyou so much. I do have one little problem and that is when I cancel the print screen I get a message saying something went wrong. How can I make sure this message doesn;t show?
    What kind of message? Can you make a prinscreen.

  10. #10
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98

    Re: One little problem

    here it is

  11. #11
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85

    Re: One little problem

    Originally posted by charlottevk
    here it is
    You have to do it as an attachment

  12. #12
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98

    Re: One little problem

    I thought I had, I'll try again. In case it doesn't work again here is what it says (I'm afraid its in Dutch but I read that you are from Holland anyway)
    ------------------------------------------------------------------------
    Fout 2212 tijdens uitvoering:

    Kan object niet afdrukken.

    Controleer of opgegeven printer beschikbaar is.
    Attached Files Attached Files

  13. #13
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85

    Re: One little problem

    Originally posted by charlottevk
    I thought I had, I'll try again. In case it doesn't work again here is what it says (I'm afraid its in Dutch but I read that you are from Holland anyway)
    ------------------------------------------------------------------------
    Fout 2212 tijdens uitvoering:

    Kan object niet afdrukken.

    Controleer of opgegeven printer beschikbaar is.
    Check in your report(design) if you have selected a printer.

  14. #14
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: One little problem

    Originally posted by charlottevk
    I thought I had, I'll try again. In case it doesn't work again here is what it says (I'm afraid its in Dutch but I read that you are from Holland anyway)
    ------------------------------------------------------------------------
    Fout 2212 tijdens uitvoering:

    Kan object niet afdrukken.

    Controleer of opgegeven printer beschikbaar is.
    Make an error Handling and check the error.Nr , if it equals to 2212 then do what you want to do, for example exit the sub.

  15. #15
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85

    Re: One little problem

    Originally posted by hammbakka
    Make an error Handling and check the error.Nr , if it equals to 2212 then do what you want to do, for example exit the sub.

    Private Sub Voorbeeld_Click()
    On Error GoTo Err_Voorbeeld_Click


    Dim stDocName As String

    stDocName = "name report"

    DoCmd.OpenReport stDocName, acPreview

    Exit_Voorbeeld_Click:
    Exit Sub

    Err_Voorbeeld_Click:
    MsgBox Err.Description
    Resume Exit_Voorbeeld_Click

    End Sub

    I think that this example might help

Posting Permissions

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