Code:
Option Compare Database
Option Explicit
Dim strSQL As String
Dim rs As DAO.Recordset
'------------------------------------------------------------
' Open_Instructions_Update
'------------------------------------------------------------
Public Function Open_Instructions_Update()
strSQL = "Instructions_Web_Output"
Set rs = CurrentDb.OpenRecordset(strSQL)
On Error GoTo Proc_err
With rs
If Not .BOF And Not .EOF Then
.MoveLast
.MoveFirst
While (Not .EOF)
With CodeContextObject
If (.Obsolete = True) Then
' Operator Instruction
DoCmd.OpenReport "Inactive Instruction", acViewPreview, "", "[Process Part Number]=[Forms]![Instructions 1 Update]![Process Part Number]", acNormal
SendKeys "{Enter}", False
DoCmd.OutputTo acOutputReport, "Inactive Instruction", "PDFFormat(*.pdf)", .[Web Output], False, "", , acExportQualityPrint
DoCmd.Close acReport, "Inactive Instruction"
DoCmd.GoToRecord acForm, "Instructions 1 Update", acNext
End If
If (IsNull(Forms![Instructions 1 Update]!Picture) And (Right((Forms![Instructions 1 Update]![Process Part Number]), 3)) = "-OP") Then
SendKeys "{Enter}", False
DoCmd.OpenReport "Inspection Instruction Report (Operator) Output", acViewPreview, "", "[Process Part Number]=[Forms]![Instructions 1 Update]![Process Part Number]", acNormal
SendKeys "Y", False
DoCmd.OutputTo acOutputReport, "Inspection Instruction Report (Operator) Output", "PDFFormat(*.pdf)", .[Web Output], False, "", , acExportQualityPrint
DoCmd.Close acReport, "Inspection Instruction Report (Operator) Output"
DoCmd.GoToRecord acForm, "Instructions 1 Update", acNext
End If
If (IsNull(Forms![Instructions 1 Update]!Picture) And (Right((Forms![Instructions 1 Update]![Process Part Number]), 3)) <> "-OP") Then
SendKeys "{Enter}", False
DoCmd.OpenReport "Inspection Instruction Report Output", acViewPreview, "", "[Process Part Number]=[Forms]![Instructions 1 Update]![Process Part Number]", acNormal
SendKeys "Y", False
DoCmd.OutputTo acOutputReport, "Inspection Instruction Report Output", "PDFFormat(*.pdf)", .[Web Output], False, "", , acExportQualityPrint
DoCmd.Close acReport, "Inspection Instruction Report Output"
DoCmd.GoToRecord acForm, "Instructions 1 Update", acNext
End If
If ((Right((Forms![Instructions 1 Update]![Process Part Number]), 3)) = "-OP") Then
SendKeys "{Enter}", False
DoCmd.OpenReport "Inspection Instruction Report (Operator) w/photo Output", acViewPreview, "", "[Process Part Number]=[Forms]![Instructions 1 Update]![Process Part Number]", acNormal
SendKeys "Y", False
DoCmd.OutputTo acOutputReport, "Inspection Instruction Report (Operator) w/photo Output", "PDFFormat(*.pdf)", .[Web Output], False, "", , acExportQualityPrint
DoCmd.Close acReport, "Inspection Instruction Report (Operator) w/photo Output"
DoCmd.GoToRecord acForm, "Instructions 1 Update", acNext
End If
If ((Right((Forms![Instructions 1 Update]![Process Part Number]), 3)) <> "-OP") Then
SendKeys "{Enter}", False
DoCmd.OpenReport "Inspection Instruction Report w/photo Output", acViewPreview, "", "[Process Part Number]=[Forms]![Instructions 1 Update]![Process Part Number]", acNormal
SendKeys "Y", False
DoCmd.OutputTo acOutputReport, "Inspection Instruction Report w/photo Output", "PDFFormat(*.pdf)", .[Web Output], False, "", , acExportQualityPrint
DoCmd.Close acReport, "Inspection Instruction Report w/photo Output"
DoCmd.GoToRecord acForm, "Instructions 1 Update", acNext
End If
End With
.MoveNext
Wend
End If
.Close
End With
exitsub:
Set rs = Nothing
Exit Function
Proc_err:
Resume Next
End Function
"Y" can be replaced by "ENTER"
Comment