📄 frmcustomer.frm
字号:
Top = 1695
Width = 810
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "客户地址:"
Height = 180
Index = 3
Left = 555
TabIndex = 7
Top = 3690
Width = 810
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "客户简称:"
Height = 180
Index = 2
Left = 540
TabIndex = 5
Top = 1290
Width = 810
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "客户名称:"
Height = 180
Index = 1
Left = 540
TabIndex = 3
Top = 900
Width = 810
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "客户代码:"
Height = 180
Index = 0
Left = 540
TabIndex = 1
Top = 525
Width = 810
End
End
Begin MSComctlLib.ImageList ImageList2
Left = 8805
Top = 600
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 11
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmCustomer.frx":004A
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmCustomer.frx":049E
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmCustomer.frx":08F2
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmCustomer.frx":0D46
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmCustomer.frx":119A
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmCustomer.frx":15EE
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmCustomer.frx":1A42
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmCustomer.frx":1E96
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmCustomer.frx":22EA
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmCustomer.frx":4FF4
Key = ""
EndProperty
BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmCustomer.frx":6CFE
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 795
Left = 0
TabIndex = 30
Top = 0
Width = 8670
_ExtentX = 15293
_ExtentY = 1402
ButtonWidth = 1032
ButtonHeight = 1349
Appearance = 1
Style = 1
ImageList = "ImageList2"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 11
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "加入"
ImageIndex = 1
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
ImageIndex = 4
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "查询"
ImageIndex = 11
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "打印"
ImageIndex = 10
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
ImageIndex = 9
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.Visible = 0 'False
Caption = "确定"
ImageIndex = 6
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.Visible = 0 'False
Caption = "取消"
ImageIndex = 7
EndProperty
EndProperty
BorderStyle = 1
End
End
Attribute VB_Name = "frmCustomer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'11
Private Mode As String
Dim s As String
Private Sub cButton(b As Boolean)
Toolbar1.Buttons(2).Enabled = b
Toolbar1.Buttons(3).Enabled = b
Toolbar1.Buttons(4).Enabled = b
Toolbar1.Buttons(5).Enabled = b
Toolbar1.Buttons(6).Enabled = b
Toolbar1.Buttons(8).Enabled = b
Toolbar1.Buttons(10).Visible = Not b
Toolbar1.Buttons(11).Visible = Not b
End Sub
Private Sub cText(b As Boolean)
On Error GoTo eH
Dim i As Long
Dim t As Control
If Not b Then i = vbWhite Else i = &HE0E0E0
For Each t In Me.Controls
If TypeOf t Is TextBox Then
t.Locked = b
t.BackColor = i
End If
Next
Combo1.Locked = b: Combo1.BackColor = i
Combo2.Locked = b: Combo2.BackColor = i
Exit Sub
eH:
MsgBox em & vbNewLine & "错误号:1101" & vbNewLine & "错误描述:" & Err.Description
End Sub
Private Sub ADO_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
ADO.Caption = ADO.Recordset.AbsolutePosition & "/" & ADO.Recordset.RecordCount
End Sub
Private Sub Form_Load()
On Error GoTo eH
If g_rst.State = 1 Then g_rst.Close
Combo1.Clear
g_rst.Open "select 客户分类名称 as mz from 客户分类"
While Not g_rst.EOF
If Not IsNull(g_rst!mz) Then Combo1.AddItem g_rst!mz
g_rst.MoveNext
Wend
If g_rst.State = 1 Then g_rst.Close
Combo2.Clear
g_rst.Open "select 客户性质 as mz from 客户性质"
While Not g_rst.EOF
If Not IsNull(g_rst!mz) Then Combo2.AddItem g_rst!mz
g_rst.MoveNext
Wend
ADO.ConnectionString = g_cnnStr
ADO.RecordSource = "select * from 客户资料"
ADO.Refresh
cText (True)
Exit Sub
eH:
MsgBox em & vbNewLine & "错误号:1102" & vbNewLine & "错误描述:" & Err.Description
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error GoTo eH
Dim t As Control
Select Case Button.Caption
Case "加入"
cButton (False)
Set DG.DataSource = Nothing
ADO.Recordset.AddNew
cText (False)
Mode = "add"
Case "删除"
ADO.Recordset.Delete
ADO.Refresh
Case "修改"
cButton (False)
Set DG.DataSource = Nothing
cText (False)
Mode = "edit"
Case "打印"
DE.rsCustomer.Filter = s
drCustomer.Show 1
Case "查询"
cButton (False)
cText (False)
For Each t In Me.Controls
If TypeOf t Is TextBox Then
Set t.DataSource = Nothing: t.Text = ""
End If
Next
Set Combo1.DataSource = Nothing: Combo1.Text = ""
Set Combo2.DataSource = Nothing: Combo2.Text = ""
Mode = "find"
Case "确定"
If Mode <> "find" Then
ADO.Recordset.Update
Set DG.DataSource = ADO
MsgBox "操作成功!", vbInformation + vbOKOnly
ADO.Refresh
cButton (True)
cText (True)
Else
g_SQL = ""
For Each t In Me.Controls
If TypeOf t Is TextBox Then
If t.Text <> "" Then g_SQL = g_SQL & t.DataField & "='" & t.Text & "' and "
End If
Next
If Combo1.Text <> "" Then g_SQL = g_SQL & "客户分类='" & Combo1.Text & "' and "
If Combo2.Text <> "" Then g_SQL = g_SQL & "客户性质='" & Combo2.Text & "' and "
If g_SQL = "" Then Exit Sub
g_SQL = Mid(g_SQL, 1, Len(g_SQL) - 4)
s = g_SQL
ADO.RecordSource = "select * from 客户资料 where " & g_SQL
ADO.Refresh
For Each t In Me.Controls
If TypeOf t Is TextBox Then
Set t.DataSource = ADO
End If
Next
Set Combo1.DataSource = ADO
Set Combo2.DataSource = ADO
cButton (True)
cText (True)
End If
Case "取消"
If Mode <> "find" Then
ADO.Recordset.CancelUpdate
Set DG.DataSource = ADO
cButton (True)
cText (True)
Else
For Each t In Me.Controls
If TypeOf t Is TextBox Then
Set t.DataSource = ADO
End If
Next
Set Combo1.DataSource = ADO
Set Combo2.DataSource = ADO
cButton (True)
cText (True)
End If
Case "退出"
Unload Me
End Select
Exit Sub
eH:
MsgBox em & vbNewLine & "错误号:1103" & vbNewLine & "错误描述:" & Err.Description
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -