Private Sub BTN_Com2_Click()
Dim iTxt As String, iName As Variant, a As Long, Ar_Temp As Variant, b As Long
Dim itxt1 As String, itxt2 As String, itxt3 As String, itxt4 As String, itxt5 As String, itxt6 As String, itxt7 As String, itxt8 As String, itxt9 As String, itxt10 As String, id As Integer
Dim iName1 As Variant, iName2 As Variant, iName3 As Variant, iName4 As Variant, iName5 As Variant, iName6 As Variant, iName7 As Variant, iName8 As Variant, iName9 As Variant, iName10 As Variant
itxt1 = "ST_Select"
itxt2 = "ST_Back"
itxt3 = "ST_Star"
itxt4 = "ST_Dist"
itxt5 = "ST_Loc"
If Me.BTN_Com2_Label.Caption = "DELETE" Then
Me.BTN_Com2_Label.Caption = "PLEASE WAIT"
DoEvents
If StoreCat = 2 Then
StoreID = Ar_DBCZH(ST_SelectID, 1)
End If
If StoreCat = 3 Then
StoreID = Ar_DBCZL(ST_SelectID, 1)
End If
If StoreCat = 5 Then
StoreID = Ar_DBPS(ST_SelectID, 1)
Ar_DBRegStations(Ar_DBPS(ST_SelectID, 5), 20) = ""
POS_SysData(Ar_DBPS(ST_SelectID, 5), 20) = ""
DES_SysData(Ar_DBPS(ST_SelectID, 5), 20) = ""
StationData(1) = Ar_DBPS(ST_SelectID, 5)
StationData(20) = ""
Station_SN = True
Call SQL_Export_Mod(AppPath & "\DB\TCE.mdb", "Stations")
Station_SN = False
Worksheets("DB_Stations").Cells(Ar_DBPS(ST_SelectID, 5) + 1, 20) = ""
Call POS_Output_Reg
Call DES_Output_Reg
Call DES_Output_UReg
End If
If StoreCat = 6 Then
StoreID = Ar_DBPOI(ST_SelectID, 1)
End If
If StoreCat = 8 Then
StoreID = Ar_DBRE(ST_SelectID, 1)
End If
If StoreID = DES_LocID Then
NoTarget = True
DES_LocMode = False
End If
Call SQL_Export_Del(AppPath & "\DB\Logbook.mdb", "Store")
For a = 1 To AzStore
If Ar_DBStore(a, 1) = StoreID Then
LogID = Ar_DBStore(a, 2)
Worksheets("DB_Store").Range("A" & a + 1 & ":M" & a + 1).ClearContents
Exit For
End If
Next a
For a = 1 To AzLogbook
If Ar_DBLogbook(a, 1) = LogID Then
Worksheets("DB_Log").Cells(a + 1, 8).Value = ""
Worksheets("DB_Log").Cells(a + 1, 9).Value = ""
Worksheets("DB_Log").Cells(a + 1, 10).Value = 0
LogID = TL_SelectID
TL_SelectID = a
Ar_DBLogbook(a, 8) = ""
Ar_DBLogbook(a, 9) = ""
Ar_DBLogbook(a, 10) = 0
Log_edit = True
Call SQL_Export_Mod(AppPath & "\DB\Logbook.mdb", "Log")
Log_edit = False
TL_SelectID = LogID
Exit For
End If
Next a
Worksheets("DB_Store").Activate
ActiveWorkbook.Worksheets("DB_Store").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("DB_Store").Sort.SortFields.Add Key:=Range( _
"A2:A1000001"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("DB_Store").Sort
.SetRange Range("A1:M1000001")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
AzStore = Worksheets("Data").Cells(7, 5).Value
If AzStore > 0 Then
Ar_DBStore = Worksheets("DB_Store").Range("A2:M" & AzStore + 1)
Else
Ar_DBStore = Worksheets("DB_Store").Range("A2:M2")
End If
ST_SelectID = 0
Me.BTN_ST_Tab1.BackColor = 0
Me.BTN_ST_Tab1.ForeColor = &HFFFFFF
Me.BTN_ST_Tab2.BackColor = 0
Me.BTN_ST_Tab2.ForeColor = &HFFFFFF
If StoreCat = 2 Then
Call Setup_CZH
If AzCZH - 9 < 0 Then
Me.ST_Scrollbar.Max = 0
Else
Me.ST_Scrollbar.Max = AzCZH - 9
If AzCZH > 18 Then
Me.ST_Scrollbar.LargeChange = 9
Else
Me.ST_Scrollbar.LargeChange = AzCZH - 9
End If
End If
End If
If StoreCat = 3 Then
Call Setup_CZL
If AzCZL - 9 < 0 Then
Me.ST_Scrollbar.Max = 0
Else
Me.ST_Scrollbar.Max = AzCZL - 9
If AzCZL > 18 Then
Me.ST_Scrollbar.LargeChange = 9
Else
Me.ST_Scrollbar.LargeChange = AzCZL - 9
End If
End If
End If
If StoreCat = 5 Then
Call Setup_PS
If AzPS - 9 < 0 Then
Me.ST_Scrollbar.Max = 0
Else
Me.ST_Scrollbar.Max = AzPS - 9
If AzPS > 18 Then
Me.ST_Scrollbar.LargeChange = 9
Else
Me.ST_Scrollbar.LargeChange = AzPS - 9
End If
End If
End If
If StoreCat = 6 Then
Call Setup_POI
If AzPOI - 9 < 0 Then
Me.ST_Scrollbar.Max = 0
Else
Me.ST_Scrollbar.Max = AzPOI - 9
If AzPOI > 18 Then
Me.ST_Scrollbar.LargeChange = 9
Else
Me.ST_Scrollbar.LargeChange = AzPOI - 9
End If
End If
End If
If StoreCat = 8 Then
Call Setup_RE
If AzRE - 9 < 0 Then
Me.ST_Scrollbar.Max = 0
Else
Me.ST_Scrollbar.Max = AzRE - 9
If AzRE > 18 Then
Me.ST_Scrollbar.LargeChange = 9
Else
Me.ST_Scrollbar.LargeChange = AzRE - 9
End If
End If
End If
For a = 1 To 9
'------> Select
iName1 = itxt1 & a
Me.Controls(iName1).Visible = False
'------> Back
iName2 = itxt2 & a
Me.Controls(iName2).Visible = False
'------> Star
iName3 = itxt3 & a
Me.Controls(iName3).Visible = False
'------> Distance
iName4 = itxt4 & a
Me.Controls(iName4).Visible = False
'------> Location
iName5 = itxt5 & a
Me.Controls(iName5).Visible = False
Next a
Call ST_Scrollbar_Change
Me.ST_Note.Value = ""
Me.TXT_ST_NoteCounter.Caption = 254 - Len(Me.ST_Note.Text)
Call Command_Buttons_Reset
Exit Sub
End If
If Me.BTN_Com2_Label.Caption = "EDIT LOCATION" Then
iTxt = "ST_Back"
For a = 1 To 9
iName = iTxt & a
If Me.Controls(iName).BackColor = TCE_Color Then
Me.ST_TB_Location.Top = Me.Controls(iName).Top
iTxt = "ST_Loc"
iName = iTxt & a
Me.ST_TB_Location.Text = Me.Controls(iName).Caption
Me.ST_TB_Location.Visible = True
Me.ST_TB_Location.SetFocus
Exit For
End If
Next a
Call Command_Buttons_Reset
Me.BTN_Com1.Visible = True
Me.BTN_Com1_Back.Visible = True
Me.BTN_Com1_Label.Caption = "CANCEL"
Me.BTN_Com1_Label.Visible = True
Exit Sub
End If
If Me.BTN_Com2_Label.Caption = "CANCEL" Then
Me.ST_TB_Location.Visible = False
If StoreCat = 1 Then
a = Ar_DBBM(ST_SelectID, 4)
End If
If StoreCat = 2 Then
a = Ar_DBCZH(ST_SelectID, 4)
End If
If StoreCat = 3 Then
a = Ar_DBCZL(ST_SelectID, 4)
End If
If StoreCat = 4 Then
a = Ar_DBOF(ST_SelectID, 4)
End If
If StoreCat = 5 Then
a = Ar_DBPS(ST_SelectID, 4)
End If
If StoreCat = 6 Then
a = Ar_DBPOI(ST_SelectID, 4)
End If
If StoreCat = 7 Then
a = Ar_DBRC(ST_SelectID, 4)
End If
If StoreCat = 8 Then
a = Ar_DBRE(ST_SelectID, 4)
End If
If StoreCat = 9 Then
a = Ar_DBSY(ST_SelectID, 4)
End If
Call Command_Buttons_Reset
If ActualStarID <> a Then
Me.BTN_Com1.Visible = True
Me.BTN_Com1_Back.Visible = True
Me.BTN_Com1_Label.Caption = "SET AS DESTINATION"
Me.BTN_Com1_Label.Visible = True
Me.BTN_Com2.Visible = True
Me.BTN_Com2_Back.Visible = True
Me.BTN_Com2_Label.Caption = "DELETE"
Me.BTN_Com2_Label.Visible = True
If StoreCat = 2 Or StoreCat = 3 Or StoreCat = 6 Or StoreCat = 8 Then
Me.BTN_Com3.Visible = True
Me.BTN_Com3_Back.Visible = True
Me.BTN_Com3_Label.Caption = "EDIT LOCATION"
Me.BTN_Com3_Label.Visible = True
End If
Else
Me.BTN_Com1.Visible = True
Me.BTN_Com1_Back.Visible = True
Me.BTN_Com1_Label.Caption = "DELETE"
Me.BTN_Com1_Label.Visible = True
If StoreCat = 2 Or StoreCat = 3 Or StoreCat = 6 Or StoreCat = 8 Then
Me.BTN_Com3.Visible = True
Me.BTN_Com3_Back.Visible = True
Me.BTN_Com3_Label.Caption = "EDIT LOCATION"
Me.BTN_Com3_Label.Visible = True
End If
End If
Exit Sub
End If
End Sub
Private Sub BTN_Com3_Click()
Dim iTxt As String, iName As Variant, a As Long, Ar_Temp As Variant, b As Long
Dim itxt1 As String, itxt2 As String, itxt3 As String, itxt4 As String, itxt5 As String, itxt6 As String, itxt7 As String, itxt8 As String, itxt9 As String, itxt10 As String, id As Integer
Dim iName1 As Variant, iName2 As Variant, iName3 As Variant, iName4 As Variant, iName5 As Variant, iName6 As Variant, iName7 As Variant, iName8 As Variant, iName9 As Variant, iName10 As Variant
If Me.BTN_Com3_Label.Caption = "EDIT LOCATION" Then
iTxt = "ST_Back"
For a = 1 To 9
iName = iTxt & a
If Me.Controls(iName).BackColor = TCE_Color Then
Me.ST_TB_Location.Top = Me.Controls(iName).Top
iTxt = "ST_Loc"
iName = iTxt & a
Me.ST_TB_Location.Text = Me.Controls(iName).Caption
Me.ST_TB_Location.Visible = True
Me.ST_TB_Location.SetFocus
Exit For
End If
Next a
Call Command_Buttons_Reset
Me.BTN_Com1.Visible = True
Me.BTN_Com1_Back.Visible = True
Me.BTN_Com1_Label.Caption = "CANCEL"
Me.BTN_Com1_Label.Visible = True
Exit Sub
End If
End Sub