Best Practice question

  • Thread starter Thread starter JIM
  • Start date Start date
J

JIM

I have a Work Order Form that while a new record is being created a
true/False field called PrintWorkOrder is turned to True. That is so that
when operator goes to print from the Work Orders only those that haven't been
printed yet will be printed. My question is how can I turn the switch to
False once it's been printed? Is there a way to call an update query from a
report? Or any other suggestions?
TIA
 
I would run the report from code and then prompt the user if they want to
mark the record as having been printed successfully.
 
Are you printing these as a batch, or one at a time?

Are you sending the reports to the screen first, for preview, and printing
from the screen, or are you sending the reports directly to the printer.
This matters, since if you go to print preview first, there does not appear
to be a good method to determine whether the report was actually printed vice
displayed. I have a shortcut menu I use for all my reports, that allows the
user to print or close a report when in preview mode. I would insert some
code in my ReportPrint function to run an update query.

If you are printing directly rather than going to print preview, I think I'd
execute an Update query right after the printing process is complete.

Either way, I like Duane's suggestion to ask the user what he/she wants to
do first.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
Thanks Duane and Dale for input. Dale, I wanted to print the Work Orders in
a batch so operator can enter all work orders first. I realize from your
responses that printing from the form is best. I don't think a preview is
needed as the WO form has all the same info as the printed WO. Do you
suggest I print one at a time? At least that way if WO doesn't print it
could be reprinted.
TIA
 
I assume that you can always call a particular work order up and print it
individually, if it doesn't print properly.

If that is the case, I'd print them all at once and execute a single Update
query to set the value of PrintWorkOrder to false. Something like:

'Check the number of commas in the following line. You want the criteria in
the Where argument
Docmd.openreport "reportname",,, "[PrintWorkOrder] = -1"
currentdb.execute "UPDATE tbl_WorkOrder SET [PrintWorkOrder] = 0 WHERE
[PrintWorkOrder] = -1"

Dale
 
Here's what I have so far and it's working great:
Private Sub Option156_Click()
If Me.Dirty Then Me.Dirty = False
If Me.NewRecord Then 'Check there is a record to
print
MsgBox "Select a record to print"
Else
DoCmd.OpenReport "rptWorkOrders", , , "[WONo] = " & Me![txtWoNo]
End If
End Sub

And this command button will probably stay, it prints one at a time. I got
to thinking...it helps Ha!-why am I using a switch when I have the date
field. I'll just print all work orders, with another command button that
equal current date. Thanks so much for your help.

Dale Fye said:
I assume that you can always call a particular work order up and print it
individually, if it doesn't print properly.

If that is the case, I'd print them all at once and execute a single Update
query to set the value of PrintWorkOrder to false. Something like:

'Check the number of commas in the following line. You want the criteria in
the Where argument
Docmd.openreport "reportname",,, "[PrintWorkOrder] = -1"
currentdb.execute "UPDATE tbl_WorkOrder SET [PrintWorkOrder] = 0 WHERE
[PrintWorkOrder] = -1"

Dale

JIM said:
Thanks Duane and Dale for input. Dale, I wanted to print the Work Orders
in
a batch so operator can enter all work orders first. I realize from your
responses that printing from the form is best. I don't think a preview is
needed as the WO form has all the same info as the printed WO. Do you
suggest I print one at a time? At least that way if WO doesn't print it
could be reprinted.
TIA
 
Back
Top