Private Sub cmdSOTrack_Click()
'For Testing
'txtSOEntry = 1666458 '<------ FedEx Test
txtSOEntry = 1078290 '<------ UPS Test
'txtSOEntry = 1680136 '<------ USPS Test
'txtSOEntry = 1666439 '<------ ESTES Test
If txtSOEntry = "" Or txtSOEntry = " " Then
MsgBox "Please enter a PO or Sale Order Number to track", vbOKOnly, "Need A Number"
txtSOEntry.BackColor = &HC0FFFF
End If
ConnectDatabase
strSQL = "SELECT * FROM LAWSON_BSACLIPTRK " & _
"Where LAWSON_BSACLIPTRK.ORDER_NBR = " & txtSOEntry
Set rsLAWSON_BSACLIPTRK = dbResourceLocatorDatabase.OpenRecordset(strSQL, dbOpenDynaset)
rsLAWSON_BSACLIPTRK.MoveLast
intShipmentCount = rsLAWSON_BSACLIPTRK.RecordCount
If intShipmentCount > 1 Then
MsgBox "There are " & intShipmentCount &" shipments... Please use the 'Next Record' button to view other shipments", vbOKOnly, "Multiple Shipments"
cmdNext.Enabled = True
End If
txtTrackingResult = Trim(rsLAWSON_BSACLIPTRK!TRACKING_NBR)
lblCarrierResult = rsLAWSON_BSACLIPTRK!CAR_NAME
txtPONumber = Trim(rsLAWSON_BSACLIPTRK!PUR_NBR)
'-------------------------------------------------------------------------------------------------
'Date Conversion
strYear = Mid(rsLAWSON_BSACLIPTRK!DATE_IN, 1, 4)
strMonth = Mid(rsLAWSON_BSACLIPTRK!DATE_IN, 5, 2)
strDay = Mid(rsLAWSON_BSACLIPTRK!DATE_IN, 7, 2)
strDate = strMonth & "/" & strDay & "/" & strYear
lblShipDateResult = strDate
'-------------------------------------------------------------------------------------------------
'Time Conversion
strHour = Mid(rsLAWSON_BSACLIPTRK!R_TIME, 1, 2)
strMinute = Mid(rsLAWSON_BSACLIPTRK!R_TIME, 2, 2)
Select Case strHour
Case Is > 12
strHour = strHour - 12
strTimeOfDay = " p.m."
Case Is < 12
strTimeOfDay = " a.m."
Case Is = 12
strTimeOfDay = " p.m."
End Select
strTime = strHour & ":" & strMinute & strTimeOfDay
lblTime = strTime
'-------------------------------------------------------------------------------------------------
lblFreightChargeResult = rsLAWSON_BSACLIPTRK!FRT_CHG
lblFreightChargeResult = "$" & lblFreightChargeResult / 100
lblFreightChargeResult = Format(lblFreightChargeResult, "Currency")
If InStr(lblCarrierResult, "UPS") <> 0 Then
imgTrackingViewer.Picture = LoadPicture("C:\Documents and Settings\gstallin\My Documents\Visual Basic Programs\Resource Locator\UPS Package 1" & ".jpg")
imgESTESPage.Enabled = False
imgESTESPage.Visible = False And imgESTESPage.Visible = False
imgUSPSPage.Enabled = False
imgUSPSPage.Visible = False And imgUSPSPage.Visible = False
imgFedExPage.Visible = False And imgFedExPage.Visible = False
End If
If InStr(lblCarrierResult, "USPS") <> 0 Then
imgTrackingViewer.Picture = LoadPicture("C:\Documents and Settings\gstallin\My Documents\Visual Basic Programs\Resource Locator\USPS Truck" & ".gif")
imgUPSPage.Enabled = False
imgUPSPage.Visible = False And imgUSPSPage.Visible = False
imgESTESPage.Enabled = False
imgESTESPage.Visible = False And imgESTESPage.Visible = False
imgFedExPage.Visible = False And imgFedExPage.Visible = False
End If
If InStr(lblCarrierResult, "ESTES") <> 0 Then
imgTrackingViewer.Picture = LoadPicture("C:\Documents and Settings\gstallin\My Documents\Visual Basic Programs\Resource Locator\Estes" & ".gif")
imgUPSPage.Enabled = False
imgUPSPage.Visible = False And imgUPSPage.Visible = False
imgUSPSPage.Enabled = False
imgUSPSPage.Visible = False And imgUSPSPage.Visible = False
imgFedExPage.Visible = False And imgFedExPage.Visible = False
End If
If InStr(lblCarrierResult, "FedEx") <> 0 Then
imgTrackingViewer.Picture = LoadPicture("C:\Documents and Settings\gstallin\My Documents\Visual Basic Programs\Resource Locator\FedEx" & ".jpg")
imgUPSPage.Enabled = False
imgUPSPage.Visible = False And imgUPSPage.Visible = False
imgUSPSPage.Enabled = False
imgUSPSPage.Visible = False And imgUSPSPage.Visible = False
imgESTESPage.Visible = False And imgESTESPage.Visible = False
End If
EndSub:
'CloseDatabase
End Sub
Private Sub cmdNext_Click()
rsLAWSON_BSACLIPTRK.MoveNext
End Sub