?? main增加客戶.frm
字號:
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 225
TabIndex = 21
Top = 2970
Width = 1185
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = " 傳真 : 電話 :"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 5880
TabIndex = 20
Top = 2610
Width = 840
End
Begin VB.Label Label3
Caption = "郵政編碼:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 5790
TabIndex = 19
Top = 2145
Width = 1020
End
Begin VB.Label Label1
Caption = "客戶編號: 客戶名稱: 客戶簡稱: 客戶地址: 所屬地區: 客戶電話: "
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2400
Left = 255
TabIndex = 18
Top = 465
Width = 1200
End
End
Begin VB.Label czjl
BackStyle = 0 'Transparent
Height = 285
Left = 4050
TabIndex = 32
Top = -585
Width = 4905
End
End
End
Attribute VB_Name = "main增加客戶"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim i As Integer
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Combo2.SetFocus
Else
End If
End Sub
Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
kh(5).SetFocus
Else
End If
End Sub
Private Sub Form_Load()
On Error Resume Next
DTPicker1.Value = Date
frm主窗體.StatusBar1.Panels(1) = Me.Caption
' Data1.DatabaseName = App.Path & "\db2.mdb"
' Data1.Connect = ";pwd=" & 73322
Adodc1.RecordSource = "select * from 省份名稱"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False
Combo1.AddItem (Adodc1.Recordset.Fields("省份名稱"))
Adodc1.Recordset.MoveNext
Loop
Else
End If
Adodc2.RecordSource = "select * from csmc"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
Adodc2.Recordset.MoveFirst
Do While Adodc2.Recordset.EOF = False
Combo2.AddItem (Adodc2.Recordset.Fields("城市名稱"))
Adodc2.Recordset.MoveNext
Loop
Else
End If
End Sub
Private Sub kh_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
On Error Resume Next
'運用數組
Select Case Index
Case 0
If Index = 0 And KeyCode = vbKeyReturn Then
kh(1).SetFocus
End If
Case 1
If Index = 1 And KeyCode = vbKeyReturn Then
kh(2).SetFocus
End If
If KeyCode = vbKeyUp Then
kh(1).SetFocus
End If
Case 2
If Index = 2 And KeyCode = vbKeyReturn Then
kh(3).SetFocus
End If
If KeyCode = vbKeyUp Then
kh(1).SetFocus
End If
Case 3
If Index = 3 And KeyCode = vbKeyReturn Then
Combo1.SetFocus
' kh(4).SetFocus
End If
If KeyCode = vbKeyUp Then
kh(2).SetFocus
End If
' Case 4
' If Index = 4 And KeyCode = vbKeyReturn Then
' kh(5).SetFocus
' End If
' If KeyCode = vbKeyUp Then
' kh(3).SetFocus
' End If
Case 5
If Index = 5 And KeyCode = vbKeyReturn Then
kh(6).SetFocus
End If
If KeyCode = vbKeyUp Then
kh(4).SetFocus
End If
Case 6
If Index = 6 And KeyCode = vbKeyReturn Then
kh(7).SetFocus
End If
If KeyCode = vbKeyUp Then
kh(5).SetFocus
End If
Case 7
If Index = 7 And KeyCode = vbKeyReturn Then
kh(8).SetFocus
End If
If KeyCode = vbKeyUp Then
kh(6).SetFocus
End If
Case 8
If Index = 8 And KeyCode = vbKeyReturn Then
kh(9).SetFocus
End If
If KeyCode = vbKeyUp Then
kh(7).SetFocus
End If
Case 9
If Index = 9 And KeyCode = vbKeyReturn Then
SSTab1.Tab = 1
kh(10).SetFocus
End If
If KeyCode = vbKeyUp Then
kh(8).SetFocus
End If
Case 10
If Index = 10 And KeyCode = vbKeyReturn Then
kh(11).SetFocus
End If
If KeyCode = vbKeyUp Then
SSTab1.Tab = 0
kh(9).SetFocus
End If
Case 11
If Index = 11 And KeyCode = vbKeyReturn Then
kh(12).SetFocus
End If
If KeyCode = vbKeyUp Then
kh(10).SetFocus
End If
Case 12
If Index = 12 And KeyCode = vbKeyReturn Then
kh(13).SetFocus
End If
If KeyCode = vbKeyUp Then
kh(11).SetFocus
End If
Case 13
If Index = 13 And KeyCode = vbKeyReturn Then
kh(14).SetFocus
End If
If KeyCode = vbKeyUp Then
kh(12).SetFocus
End If
Case 14
If Index = 14 And KeyCode = vbKeyReturn Then
kh(15).SetFocus
End If
If KeyCode = vbKeyUp Then
kh(13).SetFocus
End If
Case 15
If Index = 15 And KeyCode = vbKeyReturn Then
kh(16).SetFocus
End If
If KeyCode = vbKeyUp Then
kh(14).SetFocus
End If
Case 16
If Index = 16 And KeyCode = vbKeyReturn Then
ComSave.Enabled = True
ComSave.SetFocus
End If
If KeyCode = vbKeyUp Then
kh(15).SetFocus
End If
End Select
End Sub
Private Sub ComSave_Click()
On Error Resume Next
kh(4).Text = Combo1.Text & Combo2.Text
If kh(0).Text <> "" And kh(1).Text <> "" Then
Call main
Dim DWMC, YZBM As String
Adodc4.RecordSource = "select * from 本單位信息表"
Adodc4.Refresh
If Adodc4.Recordset.RecordCount > 0 Then
DWMC = Adodc4.Recordset.Fields("單位名稱")
YZBM = Adodc4.Recordset.Fields("郵政編碼")
Else
End If
Set adoRs = adoCon.Execute("insert into kh values(" & kh(0) & ",'" & kh(1) & "','" & kh(2) & "','" & kh(3) & "','" & kh(4) & "','" & kh(5) & "','" & kh(6) & "','" & kh(7) & "','" & kh(8) & "','" & kh(9) & "','" & kh(10) & "','" & kh(11) & "','" & kh(12) & "','" & kh(13) & "','" & kh(14) & "','" & kh(15) & "','" & kh(16) & "','" & Str(DTPicker1) & "','" & DWMC & "','" & YZBM & "')")
adoCon.Close
MsgBox "數據保存成功!", , "保存信息提示"
ComSave.Enabled = False
ComCancel.Enabled = False
ComAdd.Enabled = True
Else
MsgBox ("必須輸入客戶全稱")
SSTab1.Tab = 0
kh(1).SetFocus
End If
End Sub
Private Sub ComAdd_Click()
For i = 0 To 16
kh(i).Enabled = True
kh(i).Text = ""
Adodc1.RecordSource = "select * from 客戶信息表 order by 客戶編號"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
kh(0).Text = "00001"
Else
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
kh(0).Text = Format(Adodc1.Recordset.Fields("客戶編號") + 1, "00000")
Else
End If
End If
Next i
ComSave.Visible = True
ComCancel.Enabled = True
ComAdd.Enabled = False
SSTab1.Tab = 0
kh(1).SetFocus
End Sub
Private Sub ComCancel_Click()
On Error Resume Next
For i = 0 To 16
kh(i).Enabled = False
kh(i).Text = ""
Next i
ComSave.Enabled = False
ComCancel.Enabled = False
ComAdd.Enabled = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm主窗體.Enabled = True
frm主窗體.StatusBar1.Panels(1) = "楊揚工作室 作者:小楊"
End Sub
Private Sub ComEnd_Click()
frm主窗體.Enabled = True
Unload Me
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -