Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    mike23 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2014
    Posts
    16

    Batch Printing


    I am using a checkbox on a form to add records to a "Batch Print". There is a command button on the form to print those that are marked. Is there anyway to automatically remove the checked records once I've hit the Print Batch button?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    Remove what - the value of checkbox? Is this a field in table?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mike23 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2014
    Posts
    16
    Yes, I would like to remove the checks from the boxes after the batch is printed. Yes, its a field in a table.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    Could run SQL action:

    CurrentDb.Execute "UPDATE tablename SET fieldname=False"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    mike23 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2014
    Posts
    16
    Thanks. Im still a beginner on writing code, would there be more to that code?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    You would have to put it in VBA code (macro has equivalent) for an event, such as a button click.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    mike23 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2014
    Posts
    16
    For the "Properties" of my check box, I have this code:
    Private Sub Batch_Print_Click()
    CurrentDb.Execute "UPDATE wpma SET Batch Print=False"
    End Sub

    But it doesn't work, I'm sure I'm missing something.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    Did you select [Event Procedure] in the event property then click the ellipsis (...) to open VBA editor and type code?

    Why would you put that code in event for the checkbox? Is this the bound checkbox? You need to change the value of field for all records in table? Do you have a button with code that executes print? Put the UPDATE at the end of that procedure.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    mike23 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2014
    Posts
    16
    the check box is used to mark those that need to be printed. once they are printed, I want the box to become automatically unchecked. that's why im confused on this as to where to put the code.

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    If you click the checkbox and code runs, all records will be set to false. Not what you want to do while selecting records.

    Is this a form in Datasheet or Continuous view and you are selecting multiple records for 'batch' print? Do you have a button to trigger the print? Put this new code at the end of the print procedure.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    mike23 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2014
    Posts
    16
    Its a form in continuous view. There is a command button to initiate the batch print. So I add that code into the event procedure for the command button at the end?

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    That is my suggestion.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    mike23 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2014
    Posts
    16
    or can it be done through a macro?

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    I don't use macros. Access 2010 has RunSQL method in macros. Don't remember if 2007 does. Macro can 'run' an Access query object, I think that is the OpenQuery method.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #15
    mike23 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2014
    Posts
    16
    I actually got it to achieve what I was looking for in a macro, but is there any way to stop the message box that comes up asking if you are sure you want to update the query?

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

Similar Threads

  1. Batch import
    By brandonze in forum Programming
    Replies: 6
    Last Post: 03-24-2011, 10:13 AM
  2. Batch Import and Update from DBF
    By Lady_Jane in forum Import/Export Data
    Replies: 7
    Last Post: 02-08-2011, 02:57 PM
  3. Run batch file
    By shay in forum Access
    Replies: 3
    Last Post: 12-15-2010, 09:47 AM
  4. Batch Update
    By Tyork in forum Programming
    Replies: 2
    Last Post: 11-15-2010, 05:33 PM
  5. Batch import .txt
    By hchui in forum Import/Export Data
    Replies: 1
    Last Post: 10-14-2010, 08:57 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