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?
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?
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.
Yes, I would like to remove the checks from the boxes after the batch is printed. Yes, its a field in a table.
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.
Thanks. Im still a beginner on writing code, would there be more to that code?
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.
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.
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.
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.
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.
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?
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.
or can it be done through a macro?
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.
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?