Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60

    Arrow Conditional Printing


    I have a record set with a checkbox titled "Print_Invoice". I am trying to figure out how to make this a toggle switch.

    I know how to create a button with a macro that prints an entire record set -

    Code:
    RunCommand > Print
    but how would I take this macro and make it only print the records with the checkbox ticked? (I think it would be similar to Print_Invoice="1").

    Any help appreciated!
    Thanks.

    P.S. - Just as an example, lets say these are my fields and I have 20 records.

    [Print_Invoice][Invoice_Date][Due_Date][Business_Name][Mailing_Address][Phone][Website][Email]

  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,640
    I'd use VBA code, but you can continue with the macro. Use the where condition argument, which would look something like

    Print_Invoice=-1
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60
    Thank you pbaldy - I'll stick with the macro... I just need this to work for myself, so I don't want to take shortcuts but... I dunno... I'll check this out - thanks.

  4. #4
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60
    Hmmm.... well, I am still printing every record for some reason. I added a condition, but maybe I am doing so incorrectly?

    The Macro Looks Like This:

    Code:
    [CONDITION]                    [ACTION]                    [ARGUMENTS]
    [Print_Invoice]=-1             RunCommand               Print
    When the print dialog comes up, the option to print all is selected - this prints every record. If I try to use Print Selection, it only prints the 1, selected record.

    Any idea what I'm doing wrong?

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Sorry, I assumed you were using the OpenReport action. That action includes the where condition; it wouldn't be a Condition. Are you trying to print a report?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60
    Oh - sorry it's my fault for being unclear.

    Not trying to print a report - the setup is just 1 table and 1 form, I just want to print the "forms" that are checked, not the ones that are unchecked when I hit a print all button.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Personally I'd create a report and print that; you have a lot more control over the format and content of a report. Basically, forms are designed for user interaction, reports for presentation. Offhand, I don't know how to restrict a form to certain records when it's printed.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60
    Ah I see... crap.
    I haven't really got to reports yet...
    But I guess now is as good a time as ever.

    If you don't mind - can you walk me through it a bit?

    I would start by creating a blank report, setting up my "styles" and such, and then would I have to define that it only "reports" or shows records with the "Print" checkbox set as true somehow? (Not sure how to do this part)

    Then just print the report?

    Thanks for all your help on this.

  9. #9
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60
    Nevermind - that worked like a flippin charm.
    This really is a pretty neat program...

    Thank you so much for the help!!

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Glad you got it sorted out. I've been out getting sloshed at a charity wine tasting.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60
    Good for you!
    I'm drinking by myself... sad face...

  12. #12
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60
    Got one question though - when I click the button to run the report - can I change the [Invoice_Date] field across all records in my "SubscriptionServices" table?

    So that way i don't have to update every record manually before i run the report.

    Know what i mean?

  13. #13
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    I was lucky enough to be drinking with my blushing bride and some friends. I'm not really sure what you're after, as normally I wouldn't expect all dates to change, but this would update all dates to today:

    CurrentDb.Execute "UPDATE SubscriptionServices SET [Invoice_Date] = Date()"

    You could add " WHERE Print_Invoice = -" if you only wanted to update the ones being printed. If I've misunderstood, sorry, my brain probably isn't firing on all cylinders!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #14
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60
    Congrats on the blushing bride.
    My angry pregnant wife is asleep in the couch.

    I'm being quiet...

  15. #15
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60
    Um... where might I add this tidbit?

    Code:
    CurrentDb.Execute "UPDATE SubscriptionServices SET [Invoice_Date] = Date()"
    Or maybe, "how" is a better question.
    Thank you for your patience...

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Conditional Formatting
    By Desstro in forum Programming
    Replies: 3
    Last Post: 12-01-2010, 09:52 PM
  2. conditional formatting right(..)
    By bbeernaert in forum Access
    Replies: 3
    Last Post: 08-25-2010, 12:33 AM
  3. Conditional Formatting
    By DanOzDirect in forum Reports
    Replies: 3
    Last Post: 07-21-2010, 08:49 PM
  4. count with conditional
    By humpz in forum Reports
    Replies: 3
    Last Post: 08-02-2009, 08:11 AM
  5. Conditional formatting
    By ylivne in forum Reports
    Replies: 1
    Last Post: 07-12-2009, 06:18 PM

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