1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
| Private Sub btnProcess3_Enter()
Dim strCurStep As String
Dim strSQL As String
Dim strQuery As String
Dim strErrDesc As String
Dim iNbrRecords As Integer
'On Error GoTo errHandler 'déactivé pour voir exactement où ça coince.
Me.lblCurStep.Visible = True
strCurStep = "10/300 150 QAPP Add Current year"
Me.lblCurStep.Caption = strCurStep
DoEvents
'CurrentDb.Execute "150 QAPP Add Current year"
strCurStep = "14/300 Function City_CleanUp_100_TBL. When the postal code is...."
Me.lblCurStep.Caption = strCurStep
DoEvents
'Now that we have created the table with invc numbers, run VBA module to verify Postal codes and invoice seqence.
Call City_CleanUp_100_TBL
'When the postal code is .....
'Verify ShipTo in table '100 TBL PF invoices from INVC_HDR'
strCurStep = "15/300 Function ShipTo_Manual. Verify if there are strange ShipTo addresses that need to be manually corrected."
Me.lblCurStep.Caption = strCurStep
DoEvents
strCurStep = ShipTo_Manual
DoEvents
Select Case strCurStep
Case "OK"
'There is no strange ShipTo address missing city. The process may continue
Case "Addresses to be reviewed"
'There are addresses to review. I need to use the form 160
'before opening the next form, to avoid confusion from user, I close the form '100 FRM Main' which is still open in modal mode
DoCmd.Close acForm, "100 FRM Main", acSaveNo
DoCmd.OpenForm "160 FRM Strange Address"
Exit Sub
Case Else
'There is an error message.
MsgBox "VBA function ShipTo_Manual() encountered an error." & vbCrLf & strCurStep, vbCritical, "Design error in data collection"
Exit Sub
End Select
strCurStep = "16/300 Gaps_IN....."
Me.lblCurStep.Caption = strCurStep
DoEvents
If Gaps_INVC_Nbr_Seq <> "Invoice correct" Then
'we are missing some invoices
strSQL = "INSERT INTO [002 TBL SysLog] (FunctionName, Screen, Msg1, Msg2, DateStamp ) " & _
"SELECT 'btnProcess2_Click on Form 100 FRM Main' AS FunctionName, "
strSQL = strSQL & "'" & strCurStep & "' AS Screen, "
strSQL = strSQL & "'Review invoice nbr sequence in table 100 TBL' AS Msg1, "
strSQL = strSQL & "'faulting invoice nbr available in immediate window (CTRL-G)' AS Msg2, Now() AS DateStamp;"
Debug.Print strSQL
CurrentDb.Execute strSQL
MsgBox "VBA function Gaps_INVC_Nbr_Seq() found issues with the invoice sequence. we are missing invoice numbers " & vbCrLf & "Design error in data collection"
DoCmd.Close acForm, "100 FRM Main"
Exit Sub
End If
'.... many more queries....
'Call export_Wx_input
strCurStep = "32/300 A list of S.. has now been prepared and saved on your PC. Please use...."
Me.lblCurStep.Caption = strCurStep
Forms![100 FRM Main]!btnProcess4.Enabled = True
Forms![100 FRM Main]!btnProcess4.Visible = True
Exit Sub
errHandler:
'Record as much debug details before close
strErrDesc = Err.Description
strErrDesc = Replace(strErrDesc, "'", "")
strSQL = "INSERT INTO [002 TBL SysLog] (FunctionName, Screen, Msg1, Msg2, DateStamp ) " & _
"SELECT 'btnProcess3_Click on Form 100 FRM Main' AS FunctionName, "
strSQL = strSQL & "'" & strCurStep & "' AS Screen, "
strSQL = strSQL & "'" & strErrDesc & "' AS Msg1, "
strSQL = strSQL & "' ' AS Msg2, Now() AS DateStamp;"
Debug.Print strSQL
CurrentDb.Execute strSQL
MsgBox Err.Description, vbCritical
End Sub |
Partager