📄 frm_zxdinfo.frm
字号:
Width = 1560
End
Begin VB.TextBox Text6
Height = 300
Index = 0
Left = 1125
TabIndex = 11
Text = "Text6"
Top = 2190
Width = 3400
End
Begin VB.TextBox Text5
Height = 300
Index = 0
Left = 1125
TabIndex = 9
Text = "Text5"
Top = 1815
Width = 3400
End
Begin VB.TextBox Text4
Height = 300
Index = 0
Left = 1125
TabIndex = 8
Text = "Text4"
Top = 1440
Width = 3400
End
Begin VB.TextBox Text3
Height = 300
Index = 0
Left = 1125
TabIndex = 7
Text = "Text3"
Top = 1080
Width = 1215
End
Begin VB.TextBox Text2
Height = 300
Index = 0
Left = 1125
TabIndex = 6
Text = "Text2"
Top = 750
Width = 3400
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "负责人"
Height = 180
Index = 0
Left = 2415
TabIndex = 12
Top = 1110
Width = 540
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "装修范围"
Height = 180
Index = 0
Left = 180
TabIndex = 10
Top = 1860
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "详细说明"
Height = 180
Index = 0
Left = 180
TabIndex = 5
Top = 2205
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "联系地址"
Height = 180
Index = 0
Left = 180
TabIndex = 4
Top = 1485
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "联系电话"
Height = 180
Index = 0
Left = 165
TabIndex = 3
Top = 1125
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "装修队名"
Height = 180
Index = 0
Left = 180
TabIndex = 2
Top = 765
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "出入证编号"
Height = 180
Index = 0
Left = 135
TabIndex = 1
Top = 390
Width = 900
End
End
End
Attribute VB_Name = "Frm_zxdinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command10_Click() '保存按钮
If Text2(0).Text = "" Or Text3(0).Text = "" Or Text4(0).Text = "" Or Text5(0).Text = "" Or Text6(0).Text = "" Or Text7(0).Text = "" Then
MsgBox "不允许为空", , "系统提示"
Exit Sub
Else
Call main
Set adors = adocon.Execute("insert into tab_zxgroup values('" & Text2(0) & "','" & Text7(0) & "','" & Text3(0) & "','" & Text4(0) & "','" & Text1(0) & "','" & Text5(0) & "','" & Text6(0) & "') ")
MsgBox "数据保存成功", , "系统提示"
adocon.Close
Command10.Enabled = False '保存按钮不可用
Command5.Enabled = True '添加按钮可用
Command11.Enabled = False '取消按钮不可用
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command7.Enabled = True '删除按钮可用
Command8.Enabled = True '浏览按钮可用
Adodc1.Refresh
End If
End Sub
Private Sub Command11_Click() '取消按钮
'设置控件状态
Command5.Enabled = True '添加按钮可用
Command10.Enabled = False '保存按钮不可用
Command11.Enabled = False '取消按钮不可用
Command7.Enabled = True '删除按钮可用
Command8.Enabled = True '浏览按钮可用
Command9.Enabled = True '退出按钮可用
Command1.Enabled = True '"|<" 按钮可用
Command2.Enabled = True '"<" 按钮可用
Command3.Enabled = True '">" 按钮可用
Command4.Enabled = True '">|" 按钮可用
Text2(0).Text = ""
Text3(0).Text = ""
Text4(0).Text = ""
Text5(0).Text = ""
Text6(0).Text = ""
Text7(0).Text = ""
Frame1(1).Visible = True
Text1(1).Enabled = False
Text2(1).Enabled = False
Text3(1).Enabled = False
Text4(1).Enabled = False
Text5(1).Enabled = False
Text6(1).Enabled = False
Text7(1).Enabled = False
End Sub
Private Sub Command1_Click()
Frame1(1).Visible = True
Frame1(0).Visible = False
' Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
' Adodc1.RecordSource = "select * from tab_zxgroup"
Adodc1.Refresh
' If Adodc1.Recordset.RecordCount > 0 Then
' If Adodc1.Recordset.BOF = False Then
'
' Adodc1.Recordset.MoveFirst
' Else
' MsgBox "没有记录!", , "系统提示"
' End If
If Not Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveFirst
End If
End Sub
Private Sub Command2_Click()
Frame1(1).Visible = True
Frame1(0).Visible = False
' Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
' Adodc1.RecordSource = "select * from tab_zxgroup"
' Adodc1.Refresh
' If Adodc1.Recordset.RecordCount > 0 Then
' Adodc1.Recordset.MovePrevious
' If Adodc1.Recordset.BOF Then
' Adodc1.Recordset.MoveFirst
' End If
' Else
' MsgBox "没有记录!", , "系统提示"
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
If Adodc1.Recordset.BOF = False Then
Adodc1.Recordset.MovePrevious
End If
If Adodc1.Recordset.BOF = True Then
Adodc1.Recordset.MoveFirst
MsgBox "该记录为第一条记录!", , "系统提示"
End If
End If
End Sub
Private Sub Command3_Click()
Frame1(1).Visible = True
Frame1(0).Visible = False
' Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
' Adodc1.RecordSource = "select * from tab_zxgroup"
' Adodc1.Refresh
' If Adodc1.Recordset.RecordCount > 0 Then
' Adodc1.Recordset.MoveNext
' If Adodc1.Recordset.EOF Then
' Adodc1.Recordset.MoveLast
' End If
' Else
' MsgBox "没有记录!", , "系统提示"
' End If
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
If Adodc1.Recordset.EOF = False Then
Adodc1.Recordset.MoveNext
End If
If Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.MoveLast
MsgBox "该记录为最后一条记录!", , "系统提示"
End If
End If
End Sub
Private Sub Command4_Click()
Frame1(1).Visible = True
Frame1(0).Visible = False
' Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
' Adodc1.RecordSource = "select * from tab_zxgroup"
Adodc1.Refresh
' If Adodc1.Recordset.RecordCount > 0 Then
' Adodc1.Recordset.MoveLast
' Else
' MsgBox "没有记录!", , "系统提示"
' End If
If Adodc1.Recordset.EOF = False Then
Adodc1.Recordset.MoveLast
End If
End Sub
Private Sub Command5_Click() '添加
'设置控件状态
Command5.Enabled = False '添加按钮不可用
Command10.Enabled = True '保存按钮可用
Command11.Enabled = True '取消按钮可用
Frame1(0).Visible = True
Frame1(1).Visible = False
'清空文本框内容
Text2(0).Text = ""
Text3(0).Text = ""
Text4(0).Text = ""
Text5(0).Text = ""
Text6(0).Text = ""
Text7(0).Text = ""
Text2(0).SetFocus
'设置控件状态
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command7.Enabled = False '删除按钮不可用
Command8.Enabled = False '浏览按钮不可用
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tab_zxgroup order by 出入证编号"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
If Adodc1.Recordset.EOF = False Then
Adodc1.Recordset.MoveLast
Text1(0).Text = "zxd" + Format(Val(Right(Adodc1.Recordset.Fields("出入证编号"), 3)) + 1, "###000")
'Format 函数返回 Variant (String),其中含有一个表达式,它是根据格式表达式中的指令来格式化的。
'Val 函数返回包含于字符串内的数字,字符串中是一个适当类型的数值。
'Right 函数返回 Variant (String),其中包含从字符串右边取出的指定数量的字符。
Else
Text1(0).Text = "zxd" + Format(Val(Right(Adodc1.Recordset.Fields("出入证编号"), 3)) + 1, "###000")
End If
Else
Text1(0).Text = "zxd001"
End If
End Sub
Private Sub Command7_Click() '删除
Dim myval As String
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tab_zxgroup"
' Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
myval = MsgBox("确定删除吗?", vbYesNo, "系统提示")
'MsgBox 函数在对话框中显示消息,等待用户单击按钮,并返回一个 Integer 告诉用户单击哪一个按钮。
If myval = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Refresh
Unload Me
Frm_zxdinfo.Show
Else
End If
Else
MsgBox "数据库中没有记录要删除", , "系统提示"
End If
Me.Refresh
End Sub
Private Sub Command8_Click() '浏览
Frm_zxdll.Show '显示装修队信息窗体
End Sub
Private Sub Command9_Click() '退出
Unload Me
Me.Hide
Frm_main.Show
End Sub
Private Sub Form_Load()
'设置控件状态
Text1(1).Enabled = False
Text2(1).Enabled = False
Text3(1).Enabled = False
Text4(1).Enabled = False
Text5(1).Enabled = False
Text6(1).Enabled = False
Text7(1).Enabled = False
Command10.Enabled = False
Command11.Enabled = False
'自动识别路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tab_zxgroup"
' Adodc1.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -