📄 frm_tn.frm
字号:
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 = 4
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label19
AutoSize = -1 'True
Caption = "输入要更新记录的编号然后按回车;点击要删除的记录然后按删除按钮。"
Height = 180
Left = 435
TabIndex = 35
Top = 3645
Width = 5760
End
Begin VB.Label Label20
AutoSize = -1 'True
Caption = "大楼编号:"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 360
TabIndex = 34
Top = 4200
Width = 975
End
Begin VB.Label Label21
AutoSize = -1 'True
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Left = 3630
TabIndex = 33
Top = 3720
Width = 105
End
End
Begin VB.Label Label17
Caption = "Label17"
DataField = "装修队名"
DataSource = "Adodc2"
Height = 390
Left = 4080
TabIndex = 41
Top = 5610
Width = 1020
End
End
Attribute VB_Name = "frm_zxinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub DataGrid1_Click()
Text11.Text = Adodc1.Recordset.Fields("编号")
End Sub
Private Sub Form_Load()
DTPicker1.Value = Date
DTPicker2.Value = Date
DTPicker3.Value = Date
'自动识别路径
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Set DataGrid1.DataSource = Adodc1
Set DataGrid2.DataSource = Adodc1
Set Label17.DataSource = Adodc2
Adodc2.RecordSource = "select * from tab_zxgroup"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
Adodc2.Recordset.MoveFirst
Do While Adodc2.Recordset.EOF = False
Combo1.AddItem Adodc2.Recordset.Fields("装修队名")
Adodc2.Recordset.MoveNext
Loop
End If
Adodc1.RecordSource = "select * from tab_zxinfo"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text11.Text = Adodc1.Recordset.Fields("编号")
End If
CmdSave.Enabled = False '保存按钮不可用
CmdCancel.Enabled = False '取消按钮不可用
'设置控件状态
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Combo1.Enabled = False
DTPicker1.Enabled = False
DTPicker2.Enabled = False
DTPicker3.Enabled = False
'DateTimePicker控件使您可以提供格式化的日期字段,使得进行日期选择很容易。另外,用户还可以从类似于MonthView控件的下拉式日历界面中选择日期。
End Sub
Private Sub CmdAdd_Click() '添加
'设置控件状态
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Text9.Enabled = True
Text10.Enabled = True
Combo1.Enabled = True
DTPicker1.Enabled = True
DTPicker2.Enabled = True
DTPicker3.Enabled = True
'清空文本框内容
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text2.SetFocus '设置焦点
CmdSave.Enabled = True '保存按钮可用
CmdCancel.Enabled = True '取消按钮可用
CmdAdd.Enabled = False '添加按钮不可用
Dim bh As String
Adodc1.RecordSource = "select * from tab_zxinfo order by 编号"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then '如果记录数大于零
If Adodc1.Recordset.EOF = False Then
Adodc1.Recordset.MoveLast
bh = Adodc1.Recordset.Fields("编号")
Text1.Text = "zx" + Format(Val(Right(Adodc1.Recordset.Fields("编号"), 3)) + 1, "###000")
'Format 函数返回 Variant (String),其中含有一个表达式,它是根据格式表达式中的指令来格式化的。
'Val 函数返回包含于字符串内的数字,字符串中是一个适当类型的数值。
'Right 函数返回 Variant (String),其中包含从字符串右边取出的指定数量的字符。
Else
Text1.Text = "zx" + Format(Val(Right(Adodc1.Recordset.Fields("编号"), 3)) + 1, "###000")
End If
Else
Text1.Text = "zx001"
End If
End Sub
Private Sub CmdSave_Click()
If Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Text10.Text = "" Then
MsgBox "输入信息不能为空!", , "系统提示"
Exit Sub
End If
Text4 = Trim(Val(Text4))
Text5 = Trim(Val(Text5))
Text6 = Trim(Val(Text6))
Text7 = Trim(Val(Text7))
Set adors = cn.Execute("insert into tab_zxinfo values('" & Text1 & "','" & Text2 & "','" & Text3 & "','" & Text9 & "','" & DTPicker1.Value & "','" & DTPicker3.Value & "','" & Text7 & "','" & Text4 & "','" & Text5 & "','" & DTPicker2.Value & "','" & Text6 & "','" & Text10 & "','" & Combo1 & "','" & Text8 & "') ")
MsgBox "数据保存成功!", , "系统提示"
CmdAdd.Enabled = True '添加按钮可用
CmdSave.Enabled = False '保存按钮不可用
CmdCancel.Enabled = False '取消按钮不可用
Adodc1.Refresh
Unload Me
frm_zxinfo.Show
End Sub
Private Sub CmdRefresh_Click() '
Adodc1.Refresh
End Sub
Private Sub CmdDelete_Click()
Dim myval As String
Adodc1.RecordSource = "select * from tab_zxinfo"
If Adodc1.Recordset.RecordCount > 0 Then
myval = MsgBox("确定删除吗?", vbYesNo, "系统提示")
If myval = vbYes Then Adodc1.Recordset.Delete
Else
MsgBox "数据库中没有记录要删除", , "系统提示"
End If
Me.Refresh
End Sub
Private Sub CmdCancel_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
CmdAdd.Enabled = True '添加按钮可用
CmdCancel.Enabled = False '取消按钮不可用
CmdSave.Enabled = False '保存按钮不可用
End Sub
Private Sub CmdExit_Click()
Unload Me
End Sub
Private Sub Text11_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Frm_zxinfomd.Adodc1.RecordSource = "select * from tab_zxinfo where 编号 = '" + Text11.Text + "'"
Unload Me
Frm_zxinfomd.Adodc1.Refresh
Frm_zxinfomd.Show
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text3获得焦点
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text4获得焦点
Text4.SetFocus
End If
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text6获得焦点
Text6.SetFocus
End If
End Sub
Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text7获得焦点
Text7.SetFocus
End If
End Sub
Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text8获得焦点
Text8.SetFocus
End If
End Sub
Private Sub Text7_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text9获得焦点
Text9.SetFocus
End If
End Sub
Private Sub Text8_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text5获得焦点
Text5.SetFocus
End If
End Sub
Private Sub Text9_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text10获得焦点
Text10.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -