Results 1 to 6 of 6
  1. #1
    wes9659 is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Location
    Dover, Ohio
    Posts
    88

    How To Save Record and Create Print Preview with same button on a form

    In Access I have created a button to print a preview prior to printing document it is entitle "NoVeteranMain" which works fine. Except I want it to save my document prior to printing preview how would I do it. If not after I edit it I have to re-save it prior to hitting button which generates print preview.



    This is code that is generate upon click
    Private Sub NoVet_Click()
    DoCmd.OpenReport "NoVeteranMain", acViewPreview, , "ClientID = " & Me.ClientID
    End Sub

  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
    Add

    If Me.Dirty Then Me.Dirty = False
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    wes9659 is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Location
    Dover, Ohio
    Posts
    88
    Click image for larger version. 

Name:	Screenshot 2014-04-09 10.17.53.png 
Views:	10 
Size:	152.3 KB 
ID:	16092 here is screen shot got errors

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    try it with a carriage return after the statement pbaldy gave you

    if me.dirty then me.dirty = false
    <YOUR CODE HERE>

    You may need to issue a me.refresh command before you run your report too especially if you are doing a print preview on a record that was just added. Depends on the structure of your data/data entry though.

  5. #5
    wes9659 is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Location
    Dover, Ohio
    Posts
    88
    Works Perfect Thanks Everyone for all your help

  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
    No problem.
    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. Print preview button in form
    By data808 in forum Forms
    Replies: 16
    Last Post: 01-31-2014, 11:41 AM
  2. Print Preview Button
    By data808 in forum Forms
    Replies: 2
    Last Post: 01-15-2014, 11:34 AM
  3. Print Preview Button
    By LukeJ Innov in forum Programming
    Replies: 3
    Last Post: 08-22-2013, 03:44 AM
  4. Replies: 3
    Last Post: 10-08-2012, 08:40 AM
  5. Replies: 3
    Last Post: 11-18-2011, 03:53 PM

Tags for this Thread

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