📄 frm_wxinfo.frm
字号:
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
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label21
AutoSize = -1 'True
Caption = "单击要删除的记录然后按删除按钮:"
Height = 180
Left = -74415
TabIndex = 42
Top = 4155
Width = 2880
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 = -71295
TabIndex = 41
Top = 3660
Width = 975
End
Begin VB.Label Label19
AutoSize = -1 'True
Caption = "输入要更新记录的编号然后按回车:"
Height = 180
Left = -74415
TabIndex = 40
Top = 3660
Width = 2880
End
End
Begin VB.Label Label17
Caption = "Label17"
DataField = "投诉编号"
DataSource = "Adodc2"
Height = 285
Left = 5970
TabIndex = 45
Top = 5820
Width = 945
End
End
Attribute VB_Name = "Frm_wxinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub CmdExit_Click() '退出
Unload Me
Frm_main.Show
End Sub
Private Sub Command1_Click(Index As Integer) '添加
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text10.Text = ""
Text11.Text = ""
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Text10.Enabled = True
Text11.Enabled = True
Combo1.Enabled = True
Combo2.Enabled = True
Combo3.Enabled = True
DTPicker1.Enabled = True
DTPicker2.Enabled = True
Text2.SetFocus '设置焦点在居住位置文本框上
Command1(0).Enabled = False '添加按钮不可用
Command2(1).Enabled = True '保存按钮可用
Command3(2).Enabled = True '取消按钮可用
Adodc1.RecordSource = "select * from tab_wxinfo order by 维修编号"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
If Adodc1.Recordset.EOF = False Then
Adodc1.Recordset.MoveLast
Text1.Text = "wx" + Format(Val(Right(Adodc1.Recordset.Fields("维修编号"), 3)) + 1, "###000")
Else
Text1.Text = "wx" + Format(Val(Right(Adodc1.Recordset.Fields("维修编号"), 3)) + 1, "###000")
'Format 函数返回 Variant (String),其中含有一个表达式,它是根据格式表达式中的指令来格式化的。
'Val 函数返回包含于字符串内的数字,字符串中是一个适当类型的数值。
'Right 函数返回 Variant (String),其中包含从字符串右边取出的指定数量的字符。
End If
Else
Text1.Text = "wx001"
End If
End Sub
Private Sub Command2_Click(Index As Integer) '保存
If Text6.Text <> "" Then
If Not IsNumeric(Trim(Text6.Text)) Then
'IsNumeric 函数返回 Boolean 值,指出表达式的运算结果是否为数。
'Trim 函数返回 Variant (String),其中包含指定字符串的拷贝,没有前导和尾随空白。
MsgBox "维修金额请填数字", , "系统提示"
Exit Sub
End If
Else
Text6.Text = Val(Text6.Text)
'Val 函数返回包含于字符串内的数字,字符串中是一个适当类型的数值。
End If
If Text10 = "" Then
MsgBox "处理意见不能为空! ", , "系统提示"
Exit Sub
Else
Set adors = cn.Execute("insert into tab_wxinfo values('" & Text1 & "','" & Text2 & "','" & Text11 & "','" & Text3 & "','" & Text4 & "','" & Combo1 & "','" & Combo2 & "','" & Text6 & "','" & Text7 & "','" & Trim(Str(DTPicker1)) & "','" & Trim(Str(DTPicker2)) & "','" & Text8 & "','" & Text10 & "','" & Combo3 & "') ")
MsgBox "数据保存成功!", , "系统提示"
Text1.Enabled = False '维修编号
Text2.Enabled = False '居住位置
Text3.Enabled = False '接待人
Text4.Enabled = False '维修人员
Text6.Enabled = False '维修金额
Text7.Enabled = False '维修用料
Text8.Enabled = False '业主意见
Text10.Enabled = False '处理意见
Text11.Enabled = False '维修项目
Combo1.Enabled = False '投诉编号
Combo2.Enabled = False '维修方式
Combo3.Enabled = False '状态
DTPicker1.Enabled = False '
DTPicker2.Enabled = False
'DateTimePicker控件使您可以提供格式化的日期字段,使得进行日期选择很容易。另外,用户还可以从类似于MonthView控件的下拉式日历界面中选择日期。
Command1(0).Enabled = True '添加按钮可用
Command2(1).Enabled = False '保存按钮不可用
Command3(2).Enabled = False '取消按钮不可用
Adodc1.Refresh
cn.Close
End If
End Sub
Private Sub Command3_Click(Index As Integer) '取消
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text10.Text = ""
Text11.Text = ""
Text1.Enabled = False '维修编号
Text2.Enabled = False '居住位置
Text3.Enabled = False '接待人
Text4.Enabled = False '维修人员
Text6.Enabled = False '维修金额
Text7.Enabled = False '维修用料
Text8.Enabled = False '业主意见
Text10.Enabled = False '处理意见
Text11.Enabled = False '维修项目
Combo1.Enabled = False '投诉编号
Combo2.Enabled = False '维修方式
Combo3.Enabled = False '状态
DTPicker1.Enabled = False '
DTPicker2.Enabled = False
Command1(0).Enabled = True '添加按钮可用
Command2(1).Enabled = False '保存按钮不可用
Command3(2).Enabled = False '取消按钮不可用
End Sub
Private Sub Command4_Click(Index As Integer)
Unload Me
End Sub
Private Sub Command7_Click()
Dim myval As String
Adodc1.RecordSource = "select * from tab_wxinfo"
If Adodc1.Recordset.RecordCount > 0 Then
myval = MsgBox("确定删除吗?", vbYesNo, "系统提示")
'MsgBox 函数在对话框中显示消息,等待用户单击按钮,并返回一个 Integer 告诉用户单击哪一个按钮。
If myval = vbYes Then
Adodc1.Recordset.Delete
End If
Else
MsgBox "数据库中没有记录要删除"
End If
Adodc1.RecordSource = "select * from tab_wxinfo"
Adodc1.Refresh
End Sub
Private Sub DataGrid2_Click()
Text5.Text = Adodc1.Recordset.Fields("维修编号")
End Sub
Private Sub Form_Load()
DTPicker1.Value = Date
DTPicker2.Value = Date
'自动识别路径
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc2.RecordSource = "select * from tab_tsinfo"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
Adodc2.Recordset.MoveFirst
Do While Adodc2.Recordset.EOF = False
Combo1.AddItem Label17.Caption
Adodc2.Recordset.MoveNext
Loop
End If
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tab_wxinfo order by 维修编号 "
Adodc1.Refresh
'ADO Data 控件与内部 Data 控件以及 Remote Data控件 (RDC) 相似。ADO Data 控件使您能使用 Microsoft ActiveX Data Objects (ADO) 快速地创建一个到数据库的连接。
cn.Close
Text1.Enabled = False '维修编号
Text2.Enabled = False '居住位置
Text3.Enabled = False '接待人
Text4.Enabled = False '维修人员
Text6.Enabled = False '维修金额
Text7.Enabled = False '维修用料
Text8.Enabled = False '业主意见
Text10.Enabled = False '处理意见
Text11.Enabled = False '维修项目
Combo1.Enabled = False '投诉编号
Combo2.Enabled = False '维修方式
Combo3.Enabled = False '状态
DTPicker1.Enabled = False '
DTPicker2.Enabled = False
Command2(1).Enabled = False '保存按钮不可用
Command3(2).Enabled = False '取消按钮不可用
Adodc1.RecordSource = "select * from tab_wxinfo "
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text5.Text = Adodc1.Recordset.Fields("维修编号")
End If
Set DataGrid2.DataSource = Adodc1
Set DataGrid1.DataSource = Adodc1
'DataGrid控件显示并允许对Recordset对象中代表记录和字段的一系列行和列进行数据操纵。
End Sub
Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Frm_wxinfomd.Adodc1.RecordSource = "select * from tab_wxinfo where 维修编号 = '" + Text5.Text + "'"
Unload Me
Frm_wxinfomd.Adodc1.Refresh
Frm_wxinfomd.Show ' 维修信息窗体显示
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -