Private Sub validate_product_code(ByVal strBadge As String, ByVal strLast_Name As String, ByVal mfgDate As String, ByVal Strshift As String)
'Declare Variables
Dim l_strSql As String
Dim tmpTime As Date
Dim tmpDate As Date
Dim tmpDateTime As String
Dim finalDateTime As Date
Dim StrProductLine As String
Dim ObjProdCmd As ADODB.Command
Const Event_Status = "PRODWD"
'format time and date
On Error GoTo validate_product_code_Error
Set ObjProdCmd = New ADODB.Command 'Create new command instance
With ObjProdCmd
.ActiveConnection = objOcn 'set active connection
.CommandType = adCmdStoredProc
.CommandText = "SP_Product_ID" 'Stored Proc
.Parameters.Append .CreateParameter("@ProductID", adVarChar, adParamInput, 10, txtinformation.Text)
End With
Set ObjRSprodidvalues = ObjProdCmd.Execute 'execute SP
'executes SP to validate product
ObjRSprodidvalues.Fields.Refresh 'refresh RS fields
If (ObjRSprodidvalues.BOF) = True Then
DoEvents
Load frmvoidopid
frmvoidopid.Show vbModal
Exit Sub:
Else
ObjRSprodidvalues.MoveLast 'move to last RS
End If
ObjRSprodidvalues.Fields.Refresh 'refresh RS fields
lblScaleEventID = ObjRSprodidvalues.Fields(0).Value
l_strSql = " update tbl_scale_event SET " & _
" EVENT_DATETIME = '" & finalDateTime & "', " & _
" SCALE_NUMBER = '" & CInt(StrScaleNumber) & "', " & _
" EVENT_STATUS = '" & CStr(Event_Status) & "', " & _
" Operator_badge = '" & Strshift & Replace(strBadge, "'", "''") & "', " & _
" Operator_Lastname = '" & Replace(strLast_Name, "'", "''") & "', " & _
" MANUFACTURE_DATETIME = '" & finalDateTime & "'" & _
" WHERE " & _
" Scale_Event_ID = '" & (ObjRSprodidvalues.Fields(0).Value) & "'"
Debug.Print l_strSql
m_Intwndprogress = 30
'if accepted display users Input/executes and initiates a scale transaction
objOcn.Execute l_strSql 'execute SQL statement
ObjRSprodidvalues.Fields.Refresh 'refresh the database
lblTendigitCode = "Product Code" + vbCrLf + "FW" +
check_Product_Line (StrProductLine) 'Procedure to check the relevant product - line
m_Intwndprogress = 35
Exit Sub
validate_product_code_Error:
Call ModError_log 'All error descriptions written to a error log
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure validate_product_code of Form frmscan"
End Sub