Print then open new record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with 2 sub forms. Once data is entered a person is supposed to
press a print button and the data prints on a report. I tested this on my own
computer and the report prints correctly, so no problems there. Once the
report prints I want the user to be able to tab to a new record to continue
entries. When I try this on my own computer everything works fine. When I
copy the database to a serve,r after the print command is executed the focus
leaves the form. I can click back to the form but after data is entered it is
not being saved and the print function gives me a report with blank fields.

Here is the code for the print command. Is there additional code I can add
that will save the record and take the user to a new record?

Private Sub cmdPrintBillSummary_Click()
On Error GoTo Err_cmdPrintBillSummary_Click

Dim strDocName As String
Dim strCriteria As String

strDocName = "rptBillingSummary"
strCriteria = "[WorkOrder#]=" & Me.[WorkOrder#]
DoCmd.OpenReport strDocName, acViewNormal, , strCriteria

Exit_cmdPrintBillSummary_Click:
Exit Sub

Err_cmdPrintBillSummary_Click:
MsgBox Err.Description
Resume Exit_cmdPrintBillSummary_Click

End Sub

Thanks for the help.
 
DoCmd.RunCommand acCmdSaveRecord
strDocName = "rptBillingSummary"
strCriteria = "[WorkOrder#]=" & Me.[WorkOrder#]
DoCmd.OpenReport strDocName, acViewNormal, , strCriteria
 
Okay, this helped greatly with tha save portion but I'm still at a loss as to
why the focus leaves the form after printing. The user then has to click back
on the form before moving to the next blank record. Is there an additional
line of code I can use that will take the user to the first control in a new
record?
 
Back
Top