📄 frm_ztgzcx.frm
字号:
Bindings = "Frm_ZtgzCx.frx":9C76
Height = 2070
Left = 60
TabIndex = 14
Top = 2040
Width = 5730
_ExtentX = 10107
_ExtentY = 3651
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = -1 'True
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
MarqueeStyle = 3
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label7
Caption = "等于"
Height = 270
Left = 1440
TabIndex = 23
Top = 4305
Width = 495
End
End
Attribute VB_Name = "Frm_ZtgzCx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim c
Dim BS As Integer '标识
Private Sub Cmd_Cx_Click()
AdoRs.Open "select * from tb_Goods_ztgz where ztgz_cydh='" & Txt_cx.Text & "' order by ztgz_cydh", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Text1(0).Text = AdoRs.Fields("ztgz_id")
Text1(1).Text = AdoRs.Fields("ztgz_cydh")
Text1(2).Text = AdoRs.Fields("ztgz_sjxm")
Text1(3).Text = AdoRs.Fields("ztgz_cphm")
DT1.Value = AdoRs.Fields("ztgz_dasj")
Text1(4).Text = AdoRs.Fields("ztgz_sjsj")
Text1(5).Text = AdoRs.Fields("ztgz_dadd")
Text1(6).Text = AdoRs.Fields("ztgz_bz")
Else
MsgBox "没有符合条件的查询信息", , "提示信息"
End If
AdoRs.Close
AdoRs1.Open "select * from tb_Goods_ztgzlx where ztgzlx_tydh='" & Txt_cx.Text & "'", Cnn, adOpenKeyset
If AdoRs1.RecordCount > 0 Then
Txt_lx.Text = AdoRs1.Fields("ztgzlx_lx")
End If
AdoRs1.Close
Adodc1.RecordSource = "select * from tb_Goods_ztgz where ztgz_cydh='" + Txt_cx.Text + "'"
Adodc1.Refresh
Call DBGCon
End Sub
Private Sub Dgr_Sjll_Click()
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
Text1(0).Text = Adodc1.Recordset.Fields("ztgz_id")
Text1(1).Text = Adodc1.Recordset.Fields("ztgz_cydh")
Text1(2).Text = Adodc1.Recordset.Fields("ztgz_sjxm")
Text1(3).Text = Adodc1.Recordset.Fields("ztgz_cphm")
DT1.Value = Adodc1.Recordset.Fields("ztgz_dasj")
Text1(4).Text = Adodc1.Recordset.Fields("ztgz_sjsj")
Text1(5).Text = Adodc1.Recordset.Fields("ztgz_dadd")
Text1(6).Text = Adodc1.Recordset.Fields("ztgz_bz")
End If
For i = 1 To 6
Text1(i).Locked = False
Next i
End Sub
Private Sub DT1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(6).SetFocus
End If
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Call LoadFile
DT1.Value = Date
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from tb_Goods_ztgz order by ztgz_id"
Adodc1.Refresh
Call RefreshData
Call DBGCon
End Sub
Private Sub ListView1_Click()
AdoRs.Open "select * from tb_Goods_ztgz where ztgz_cydh='" & ListView1.SelectedItem & "' order by ztgz_cydh", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Text1(0).Text = AdoRs.Fields("ztgz_id")
Text1(1).Text = AdoRs.Fields("ztgz_cydh")
Text1(2).Text = AdoRs.Fields("ztgz_sjxm")
Text1(3).Text = AdoRs.Fields("ztgz_cphm")
DT1.Value = AdoRs.Fields("ztgz_dasj")
Text1(4).Text = AdoRs.Fields("ztgz_sjsj")
Text1(5).Text = AdoRs.Fields("ztgz_dadd")
Text1(6).Text = AdoRs.Fields("ztgz_bz")
End If
AdoRs.Close
AdoRs1.Open "select * from tb_Goods_ztgzlx where ztgzlx_tydh='" & ListView1.SelectedItem & "'", Cnn, adOpenKeyset
If AdoRs1.RecordCount > 0 Then
Txt_lx.Text = AdoRs1.Fields("ztgzlx_lx")
End If
AdoRs1.Close
Adodc1.RecordSource = "select * from tb_Goods_ztgz where ztgz_cydh='" + ListView1.SelectedItem + "'"
Adodc1.Refresh
Call DBGCon
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
On Error Resume Next
If Index = 0 Then
If KeyCode = 13 Then
Adodc1.RecordSource = "select * from tb_Goods_ztgz where ztgz_cydh='" + Text1(1) + "' and ztgz_id='" + Text1(0) + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text1(0).Text = Adodc1.Recordset.Fields("ztgz_id")
Text1(1).Text = Adodc1.Recordset.Fields("ztgz_cydh")
Text1(2).Text = Adodc1.Recordset.Fields("ztgz_sjxm")
Text1(3).Text = Adodc1.Recordset.Fields("ztgz_cphm")
DT1.Value = Adodc1.Recordset.Fields("ztgz_dasj")
Text1(4).Text = Adodc1.Recordset.Fields("ztgz_sjsj")
Text1(5).Text = Adodc1.Recordset.Fields("ztgz_dadd")
Text1(6).Text = Adodc1.Recordset.Fields("ztgz_bz")
End If
End If
End If
Call DBGCon
If Index = 5 Then
If KeyCode = 40 Or KeyCode = 13 Then
DT1.SetFocus
Exit Sub
End If
End If
If Index = 6 Then
If KeyCode = 13 Then
Call Saves
Exit Sub
End If
End If
If Index = 6 Then
If KeyCode = 38 Then
DT1.SetFocus
Exit Sub
End If
End If
If Index >= 0 And KeyCode = 40 Then Text1(Index + 1).SetFocus
If Index <= 6 And KeyCode = 38 Then Text1(Index - 1).SetFocus
End Sub
Private Sub Saves() '保存信息的事件过程
If Text1(1).Text = "" Then
MsgBox "托运单号不能为空", 48, "提示信息"
Else
AdoRs2.Open "select * from tb_Goods_ztgz where ztgz_id='" + Text1(0) + "'", Cnn, adOpenKeyset
If AdoRs2.RecordCount > 0 Then
MsgBox "该信息已经存在", 48, "提示信息"
Else
c = MsgBox("确认保存信息吗", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("insert into tb_Goods_ztgz values('" & Text1(0) & "','" & Text1(1) & "','" & Text1(2) & "','" & Text1(3) & "','" & Text1(4) & "','" & Text1(5) & "','" & STR(DT1.Value) & "','" & Text1(6) & "')")
AdoRs.Open "select * from tb_Goods_ztgzlx where ztgzlx_tydh='" + Text1(1) + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Call DDTJ '统计到达的路线
Set AdoRs = Cnn.Execute("UPDATE tb_Goods_ztgzlx SET ztgzlx_lx='" + Txt_lx + "' where ztgzlx_tydh='" + Text1(1).Text + "'")
Else
Call DDTJ '统计到达的路线
Set AdoRs = Cnn.Execute("insert into tb_Goods_ztgzlx values('" & Text1(1) & "','" & Txt_lx & "')")
End If
MsgBox "数据保存成功", 64, "提示信息"
End If
Adodc1.RecordSource = "select * from tb_Goods_ztgz order by ztgz_id"
Adodc1.Refresh
Call DBGCon
End If
AdoRs2.Close
End If
Call RefreshData
End Sub
Private Sub Edits() '修改信息的事件过程
c = MsgBox("确认修改信息吗", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("UPDATE tb_Goods_ztgz SET ztgz_id='" + Text1(0) + "',ztgz_cydh='" + Text1(1) + "',ztgz_sjxm='" + Text1(2) + "',ztgz_cphm='" + Text1(3) + "',ztgz_sjsj='" + Text1(4) + "',ztgz_dadd='" + Text1(5) + "',ztgz_ddsj='" + STR(DT1.Value) + "',ztgz_bz='" + Text1(6) + "' where ztgz_id='" + Text1(0).Text + "'")
MsgBox "数据修改成功", 64, "提示信息"
Adodc1.Refresh
Call DBGCon
Else
' AdoRs.Close
End If
End Sub
Private Sub LoadFile()
AdoRs.Open "select * from tb_Goods_ztgz", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Text1(0).Text = AdoRs.Fields("ztgz_id")
Text1(1).Text = AdoRs.Fields("ztgz_cydh")
Text1(2).Text = AdoRs.Fields("ztgz_sjxm")
Text1(3).Text = AdoRs.Fields("ztgz_cphm")
DT1.Value = AdoRs.Fields("ztgz_dasj")
Text1(4).Text = AdoRs.Fields("ztgz_sjsj")
Text1(5).Text = AdoRs.Fields("ztgz_dadd")
Text1(6).Text = AdoRs.Fields("ztgz_bz")
End If
AdoRs.Close
End Sub
Private Sub Deletes() '删除信息
c = MsgBox("确认删除该信息吗", 17, "提示信息")
If c = vbOK Then
On Error Resume Next
Set AdoRs = Cnn.Execute("Delete tb_Goods_ztgz from tb_Goods_ztgz where ztgz_id='" + Text1(0).Text + "'")
Adodc1.Refresh
Call DBGCon
End If
For i = 1 To 5
Text1(i).Text = ""
Next i
Cbx_xb.Text = ""
Call RefreshData
End Sub
Private Sub DBGCon()
Dgr_Sjll.Columns(0).Caption = "编号"
Dgr_Sjll.Columns(1).Caption = "托运单号"
Dgr_Sjll.Columns(2).Caption = "司机姓名"
Dgr_Sjll.Columns(3).Caption = "车牌号码"
Dgr_Sjll.Columns(4).Caption = "司机手机"
Dgr_Sjll.Columns(5).Caption = "到达地点"
Dgr_Sjll.Columns(6).Caption = "到达日期"
Dgr_Sjll.Columns(7).Caption = "备注"
End Sub
Private Sub DDTJ()
AdoRs1.Open "select * from tb_Goods_ztgz where ztgz_cydh='" + Text1(1) + "'", Cnn, adOpenKeyset
If AdoRs1.RecordCount > 0 Then
AdoRs1.MoveFirst
Txt_lx.Text = ""
On Error Resume Next
For i = 0 To AdoRs1.RecordCount
If Txt_lx.Text = "" Then
Txt_lx.Text = "公司本部" & "-->" & AdoRs1.Fields("ztgz_dadd")
Else
Txt_lx.Text = Txt_lx.Text & "-->" & AdoRs1.Fields("ztgz_dadd")
End If
AdoRs1.MoveNext
Next i
End If
AdoRs1.Close
End Sub
Private Sub RefreshData()
AdoRs.Open "select distinct ztgz_cydh from tb_Goods_ztgz order by ztgz_cydh", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
AdoRs.MoveFirst
ListView1.ListItems.Clear
ListView1.Enabled = True
AdoRs.MoveFirst
Do While AdoRs.EOF = False
key = AdoRs.Fields("ztgz_cydh")
Set itmX = ListView1.ListItems.Add(, , key, 1)
AdoRs.MoveNext
Loop
Else
ListView1.Enabled = False
End If
AdoRs.Close
End Sub
Private Sub Txt_Cx_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Cmd_Cx_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -