📄 frm_khxx.frm
字号:
Private Sub Cbx_lb_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(2).SetFocus
End If
End Sub
Private Sub Cbx_sf_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Cbx_cs.SetFocus
End If
End Sub
Private Sub Cbx_xz_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Cbx_lb.SetFocus
End If
End Sub
Private Sub Dgr_Sjll_Click()
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
Text1(0).Text = Adodc1.Recordset.Fields("khxx_id")
Text1(1).Text = Adodc1.Recordset.Fields("khxx_mc")
Cbx_xz.Text = Adodc1.Recordset.Fields("khxx_qyxz")
Cbx_lb.Text = Adodc1.Recordset.Fields("khxx_qylx")
Text1(3).Text = Adodc1.Recordset.Fields("khxx_qyzx")
Text1(2).Text = Adodc1.Recordset.Fields("khxx_qydz")
Cbx_sf.Text = Adodc1.Recordset.Fields("khxx_szsf")
Cbx_cs.Text = Adodc1.Recordset.Fields("khxx_szcs")
Text1(4).Text = Adodc1.Recordset.Fields("khxx_gsyb")
Text1(5).Text = Adodc1.Recordset.Fields("khxx_frdb")
Text1(6).Text = Adodc1.Recordset.Fields("khxx_khyh")
Text1(7).Text = Adodc1.Recordset.Fields("khxx_yhzh")
Text1(8).Text = Adodc1.Recordset.Fields("khxx_nsh")
Text1(9).Text = Adodc1.Recordset.Fields("khxx_gswz")
Text1(10).Text = Adodc1.Recordset.Fields("khxx_gsdh")
Text1(11).Text = Adodc1.Recordset.Fields("khxx_gscz")
Text1(12).Text = Adodc1.Recordset.Fields("khxx_lxr")
Text1(13).Text = Adodc1.Recordset.Fields("khxx_lxrdh")
Cbx_jb.Text = Adodc1.Recordset.Fields("khxx_khjb")
Text1(14).Text = Adodc1.Recordset.Fields("khxx_iccard")
Text1(15).Text = Adodc1.Recordset.Fields("khxx_bz")
End If
For i = 0 To 15
Text1(i).Locked = False
Next i
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Call LoadFile
For i = 1 To 15
Text1(i).Locked = True
Next i
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from tb_khxx order by khxx_id"
Adodc1.Refresh
Call DBGCon
Call Tbr_cortrol(Tbr_xxcz, True)
End Sub
Private Sub Tbr_xxcz_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 1
Call Tbr_cortrol(Tbr_xxcz, False)
For i = 1 To 15
Text1(i).Locked = False
Text1(i).Text = ""
Text1(1).SetFocus
Next i
AdoRs.Open "select * from tb_khxx order by khxx_id", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
AdoRs.MoveLast
StrNum = Mid(AdoRs.Fields("khxx_id"), 2, Len(AdoRs.Fields("khxx_id")))
Call Con_PublicNum '调用位数转换函数
Text1(0).Text = "C" & StrIn
Else
Text1(0).Text = "C0001"
End If
AdoRs.Close
Case 2 '删除信息
Call Deletes
Call DBGCon
Case 3 '修改信息
Call Edits
Call DBGCon
Case 4 '保存信息
Call Saves
Call DBGCon
Case 5
Call Tbr_cortrol(Tbr_xxcz, True)
For i = 1 To 15
Text1(i).Text = ""
Text1(1).SetFocus
Text1(i).Locked = True
Next i
Adodc1.RecordSource = "select * from tb_khxx order by khxx_id"
Adodc1.Refresh
Call DBGCon
Case 6
ConBs = "Khzl"
Frm_CommCx.Show 1
Case 7
Unload Me
End Select
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_khxx where khxx_id='" + Text1(0).Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text1(0).Text = Adodc1.Recordset.Fields("khxx_id")
Text1(1).Text = Adodc1.Recordset.Fields("khxx_mc")
Cbx_xz.Text = Adodc1.Recordset.Fields("khxx_qyxz")
Cbx_lb.Text = Adodc1.Recordset.Fields("khxx_qylx")
Text1(3).Text = Adodc1.Recordset.Fields("khxx_qyzx")
Text1(2).Text = Adodc1.Recordset.Fields("khxx_qydz")
Cbx_sf.Text = Adodc1.Recordset.Fields("khxx_szsf")
Cbx_cs.Text = Adodc1.Recordset.Fields("khxx_szcs")
Text1(4).Text = Adodc1.Recordset.Fields("khxx_gsyb")
Text1(5).Text = Adodc1.Recordset.Fields("khxx_frdb")
Text1(6).Text = Adodc1.Recordset.Fields("khxx_khyh")
Text1(7).Text = Adodc1.Recordset.Fields("khxx_yhzh")
Text1(8).Text = Adodc1.Recordset.Fields("khxx_nsh")
Text1(9).Text = Adodc1.Recordset.Fields("khxx_gswz")
Text1(10).Text = Adodc1.Recordset.Fields("khxx_gsdh")
Text1(11).Text = Adodc1.Recordset.Fields("khxx_gscz")
Text1(12).Text = Adodc1.Recordset.Fields("khxx_lxr")
Text1(13).Text = Adodc1.Recordset.Fields("khxx_lxrdh")
Cbx_jb.Text = Adodc1.Recordset.Fields("khxx_khjb")
Text1(14).Text = Adodc1.Recordset.Fields("khxx_iccard")
Text1(15).Text = Adodc1.Recordset.Fields("khxx_bz")
End If
For i = 0 To 15
Text1(i).Locked = False
Next i
End If
End If
Call DBGCon
If KeyCode = 13 Or KeyCode = 40 Then
If Index = 1 Then
Cbx_xz.SetFocus
Exit Sub
End If
If Index = 3 Then
Cbx_sf.SetFocus
Exit Sub
End If
If Index = 13 Then
Cbx_jb.SetFocus
Exit Sub
End If
If Index >= 0 Then Text1(Index + 1).SetFocus
End If
If Index = 14 Then
If KeyCode = 38 Then
Cbx_jb.SetFocus
Exit Sub
End If
End If
If Index = 4 Then
If KeyCode = 38 Then
Cbx_cs.SetFocus
Exit Sub
End If
End If
If Index = 2 Then
If KeyCode = 38 Then
Cbx_lb.SetFocus
Exit Sub
End If
End If
If Index = 15 Then
If KeyCode = 13 Then
Call Saves
End If
End If
If Index >= 0 And KeyCode = 40 Then Text1(Index + 1).SetFocus
If Index <= 15 And KeyCode = 38 Then Text1(Index - 1).SetFocus
End Sub
Private Sub Saves() '保存信息的事件过程
If Text1(1).Text = "" Or Text1(5).Text = "" Then
MsgBox "重要信息不能为空值", 48, "提示信息"
Else
AdoRs.Open "select * from tb_khxx where khxx_mc='" + Text1(1).Text + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
MsgBox "该客户信息已经存在", 48, "提示信息"
AdoRs.Close
Else
AdoRs.Close
c = MsgBox("确认保存信息吗", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("insert into tb_khxx values('" & Text1(0) & "','" & Text1(1) & "','" & Cbx_xz & "','" & Cbx_lb & "','" & Text1(3) & "','" & Text1(2) & "','" & Cbx_sf & "','" _
& Cbx_cs & "','" & Text1(4) & "','" & Text1(5) & "','" & Text1(6) & "','" & Text1(7) & "','" & Text1(8) & "','" & Text1(14) & "','" & Text1(9) & "','" & Text1(10) & "','" & Text1(11) & "','" & Text1(12) _
& "','" & Text1(13) & "','" & Cbx_jb & "','" & Text1(15) & "')")
MsgBox "数据保存成功", 64, "提示信息"
Else
End If
Adodc1.RecordSource = "select * from tb_khxx order by khxx_id"
Adodc1.Refresh
Call DBGCon
End If
Call Tbr_cortrol(Tbr_xxcz, True)
End If
End Sub
Private Sub Edits() '修改信息的事件过程
On Error Resume Next
AdoRs.Open "select * from tb_Goods_sqd where sqd_khmc='" + Text1(1) + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
MsgBox "该客户有托运申请信息,不允许修改", 48, "提示信息"
Else
c = MsgBox("确认修改信息吗", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("UPDATE tb_khxx SET khxx_id='" + Text1(0) + "',khxx_mc='" + Text1(1) + "',khxx_qyxz='" + Cbx_xz + "',khxx_qylx='" + Cbx_lb + "',khxx_qyzx='" + Text1(3) + "',khxx_qydz='" _
+ Text1(2) + "',khxx_szsf='" + Cbx_sf + "',khxx_szcs='" + Cbx_cs + "',khxx_gsyb='" + Text1(4) + "',khxx_frdb='" + Text1(5) + "',khxx_khyh='" + Text1(6) + "',khxx_yhzh='" + Text1(7) + "',khxx_nsh='" _
+ Text1(8) + "',khxx_gswz='" + Text1(9) + "',khxx_gsdh='" + Text1(10) + "',khxx_gscz='" + Text1(11) + "',khxx_lxr='" + Text1(12) + "',khxx_lxrdh='" + Text1(13) + "',khxx_khjb='" + Cbx_jb + "',khxx_iccard='" _
+ Text1(14) + "',khxx_bz='" + Text1(15) + "' where khxx_id='" + Text1(0).Text + "'")
MsgBox "数据修改成功", 64, "提示信息"
Adodc1.RecordSource = "select * from tb_khxx order by khxx_id"
Adodc1.Refresh
StrId = Text1(0).Text
StrTitle = Text1(1).Text
Call joinRZ
Call DBGCon
Else
End If
End If
AdoRs.Close
End Sub
Private Sub LoadFile()
AdoRs.Open "select * from tb_khxx", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Text1(0).Text = AdoRs.Fields("khxx_id")
Text1(1).Text = AdoRs.Fields("khxx_mc")
Cbx_xz.Text = AdoRs.Fields("khxx_qyxz")
Cbx_lb.Text = AdoRs.Fields("khxx_qylx")
Text1(3).Text = AdoRs.Fields("khxx_qyzx")
Text1(2).Text = AdoRs.Fields("khxx_qydz")
Cbx_sf.Text = AdoRs.Fields("khxx_szsf")
Cbx_cs.Text = AdoRs.Fields("khxx_szcs")
Text1(4).Text = AdoRs.Fields("khxx_gsyb")
Text1(5).Text = AdoRs.Fields("khxx_frdb")
Text1(6).Text = AdoRs.Fields("khxx_khyh")
Text1(7).Text = AdoRs.Fields("khxx_yhzh")
Text1(8).Text = AdoRs.Fields("khxx_nsh")
Text1(9).Text = AdoRs.Fields("khxx_gswz")
Text1(10).Text = AdoRs.Fields("khxx_gsdh")
Text1(11).Text = AdoRs.Fields("khxx_gscz")
Text1(12).Text = AdoRs.Fields("khxx_lxr")
Text1(13).Text = AdoRs.Fields("khxx_lxrdh")
Cbx_jb.Text = AdoRs.Fields("khxx_khjb")
Text1(14).Text = AdoRs.Fields("khxx_iccard")
Text1(15).Text = AdoRs.Fields("khxx_bz")
End If
AdoRs.Close
End Sub
Private Sub Deletes() '删除信息
AdoRs.Open "select * from tb_Goods_sqd where sqd_khmc='" + Text1(1) + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
MsgBox "该客户有托运申请信息,不允许删除", 48, "提示信息"
Else
c = MsgBox("确认删除该信息吗", 17, "提示信息")
If c = vbOK Then
On Error Resume Next
Set AdoRs = Cnn.Execute("Delete tb_khxx from tb_khxx where khxx_id='" + Text1(0).Text + "'")
Adodc1.Refresh
End If
For i = 0 To 15
Text1(i).Text = ""
Next i
Cbx_xz.Text = ""
Cbx_lb.Text = ""
Cbx_sf.Text = ""
Cbx_cs.Text = ""
Cbx_jb.Text = ""
End If
AdoRs.Close
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 = "所属城市"
Dgr_Sjll.Columns(8).Caption = "邮编"
Dgr_Sjll.Columns(9).Caption = "法人代表"
Dgr_Sjll.Columns(10).Caption = "开户银行"
Dgr_Sjll.Columns(11).Caption = "银行账户"
Dgr_Sjll.Columns(12).Caption = "纳税号"
Dgr_Sjll.Columns(13).Caption = "IC卡号"
Dgr_Sjll.Columns(14).Caption = "公司网址"
Dgr_Sjll.Columns(15).Caption = "公司电话"
Dgr_Sjll.Columns(16).Caption = "传真"
Dgr_Sjll.Columns(17).Caption = "联系人"
Dgr_Sjll.Columns(18).Caption = "联系人电话"
Dgr_Sjll.Columns(19).Caption = "客户级别"
Dgr_Sjll.Columns(20).Caption = "备注"
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Lbl_Num.Caption = "当前数据表中共有 " & Adodc1.Recordset.RecordCount & " 条记录"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -