Results 1 to 6 of 6
  1. #1
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76

    acDialog

    I have a report, on it a button and this code.

    DoCmd.OpenForm "Frm_PrintTo", acNormal, WindowMode:=acDialog
    MsgBox "User input was: " & Forms!Frm_PrintTo!PrinterName

    The form "Frm_printTo" opens just fine, the user then selects a printer, the printer name is set to the txtBox named "PrinterName", I then save and close the Frm_PrintTo form.
    This works.

    But the main form crashes on the MsgBox line.

    Seems like the main form can't get the PrinterName data since the PrintTo form is closed, but I thought that this is how it worked?
    What am I missing?


    Thanks.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No, you can't get a value from a form that's closed. The type of thing you're doing would typically done by hiding the PrintTo form in it's code. Once it's hidden the code in this form will continue, so you can get the value from it and then close it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76
    How do I hide the PrintTo form? I have made the visibility false but my code does not continue. is hiding different then visibility?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    That's correct. You're doing it from within the dialog form? Basically you hide it rather than close it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76
    Got it, things are working correctly. Thanks!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 8
    Last Post: 05-06-2013, 03:14 AM

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