Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2008
    Location
    All over, Now in Missouri
    Posts
    73

    Unanswered: Set Focus to Report?

    I have a form that has several unbound fields, once the user fills them in I use VBA to open a report (one page certificate) of the data that was filled in. The report looks perfect, but printing results in the form printing and not the report. I tried messing with popup and selectobject but no luck.

    code
    ' this report is populated from a form call frmstudentcertificates

    stDocName = "rptStudentCertificates_Replacement"
    DoCmd.OpenReport stDocName, acPreview

    Note: If I close the form after the Docmd.openreport, then the report will print, but my data is gone.

    Should I be placing some code for focusing on the report in my last line?

    Thanks in advance

    Peter
    We tend to look at Linear paths which can lead us to a path of resistance!

  2. #2
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580
    "but printing results in the form printing and not the report"?

    Afraid to say I don't understand what you mean;

    Could you try and re-phrase your explanation please?

    Are you able to upload a .zip of your database?
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  3. #3
    Join Date
    Apr 2008
    Location
    All over, Now in Missouri
    Posts
    73
    I can't zi due to FE and BE connections.

    Basically, when I try to print a report - it outputs the form that it got the data from.
    We tend to look at Linear paths which can lead us to a path of resistance!

  4. #4
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580
    Not sure why;

    Maybe hide the form during the report_open event

    Forms!yourformname.visible = false

    Reveal it on the report close event;

    Forms!yourformname.visible = true

    You could also maximise the reoprt during the on open event.

    How are you printing it? via code?
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    That is unbelievable! I will be interested to see what is going on there :lol:

    DoCmd.OpenReport is unable to open/print a form!!

    Compact and Repair?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Note: If I close the form after the Docmd.openreport, then the report will print, but my data is gone.
    Hmmm.... exactly how are you getting the report to print a form of unbound fields? Perhaps the answer is to have the form store the entries in a table and then the report is "normal" and it might just print properly?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    Apr 2008
    Location
    All over, Now in Missouri
    Posts
    73
    That did the trick, I had my form add a record to a table, close the form, then I ran the report, then delete the record after it printed (all with code).

    - I needed this to print a graduation certificate for someone who took my course a few years before I kept permanent records with a database!
    We tend to look at Linear paths which can lead us to a path of resistance!

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Glad you've got it sorted
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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