📄 frm_tsinfo.frm
字号:
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame Frame2
Height = 750
Left = 3855
TabIndex = 34
Top = 3975
Width = 3600
Begin VB.CommandButton Command10
Caption = "退出"
Height = 350
Left = 2835
TabIndex = 40
Top = 240
Width = 705
End
Begin VB.CommandButton Command9
Caption = "浏览"
Height = 350
Left = 2145
TabIndex = 39
Top = 240
Width = 705
End
Begin VB.CommandButton Command8
Caption = "删除"
Height = 350
Left = 1455
TabIndex = 38
Top = 240
Width = 705
End
Begin VB.CommandButton Command7
Caption = "取消"
Height = 350
Left = 765
TabIndex = 37
Top = 240
Width = 705
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 350
Left = 75
TabIndex = 35
Top = 240
Width = 705
End
Begin VB.CommandButton Command2
Caption = "保存"
Height = 350
Left = 75
TabIndex = 36
Top = 240
Width = 705
End
End
Begin VB.Frame Frame4
Height = 750
Left = 225
TabIndex = 29
Top = 3975
Width = 3585
Begin VB.CommandButton Command3
Caption = "第一个"
Height = 350
Left = 45
TabIndex = 33
Top = 255
Width = 875
End
Begin VB.CommandButton Command4
Caption = "上一个"
Height = 350
Left = 915
TabIndex = 32
Top = 255
Width = 875
End
Begin VB.CommandButton Command5
Caption = "下一个"
Height = 350
Left = 1785
TabIndex = 31
Top = 255
Width = 875
End
Begin VB.CommandButton Command6
Caption = "最后一个"
Height = 350
Left = 2655
TabIndex = 30
Top = 255
Width = 875
End
End
End
Attribute VB_Name = "Frm_xqtsinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click() '添加
Frame1(0).Visible = True
Text8(0).SetFocus
Adodc1.RecordSource = "select * from tab_tsinfo order by 投诉编号"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
If Adodc1.Recordset.EOF = False Then
Adodc1.Recordset.MoveLast
Text1(0).Text = "ts" & Format(Val(Right(Adodc1.Recordset.Fields("投诉编号"), 3)) + 1, "###000")
Else
Text1(0).Text = "ts" & Format(Val(Right(Adodc1.Recordset.Fields("投诉编号"), 3)) + 1, "###000")
'Format 函数返回 Variant (String),其中含有一个表达式,它是根据格式表达式中的指令来格式化的。
'Val 函数返回包含于字符串内的数字,字符串中是一个适当类型的数值。
'Right 函数返回 Variant (String),其中包含从字符串右边取出的指定数量的字符。
End If
Else
Text1(0).Text = "ts001"
End If
Command1.Visible = False '添加按钮不可见
Command2.Visible = True '保存按钮可见
'清空文本框内容
Text2(0).Text = ""
Text3(0).Text = ""
Text5(0).Text = ""
Text6(0).Text = ""
Text7(0).Text = ""
Text8(0).Text = ""
Text9(0).Text = ""
Text10(0).Text = ""
End Sub
Private Sub Command10_Click() '退出
Unload Me
Frm_main.Show
End Sub
Private Sub Command2_Click() '保存
Command2.Visible = False
Command1.Visible = True
If Text2(0).Text = "" Or Text3(0).Text = "" Or Text5(0).Text = "" Or Text6(0).Text = "" Or Text7(0).Text = "" Or Text8(0).Text = "" Or Text9(0).Text = "" Or Text10(0).Text = "" Or Combo1(0).Text = "" Or Combo2(0).Text = "" Or Combo3(0).Text = "" Or Combo4(0).Text = "" Then
MsgBox "输入数据不允许为空", , "系统提示"
Exit Sub
Else
Call main
Set adors = adocon.Execute("insert into tab_tsinfo values('" & Text1(0) & "','" & Text2(0) & "','" & Text8(0) & "','" & Combo1(0) & "','" & Text3(0) & "','" & Trim(DTPicker1(0)) & "','" & Text5(0) & "','" & Text10(0) & "','" & Text7(0) & "','" & Combo2(0) & "','" & Combo3(0) & "','" & Combo4(0) & "','" & Text6(0) & "','" & Text9(0) & "') ")
MsgBox "数据保存成功", , "系统提示"
Adodc1.Refresh
adocon.Close
End If
End Sub
Private Sub Command3_Click() '第一个
Frame1(1).Visible = True
'Frame 控件为控件提供可标识的分组。Frame 可以在功能上进一步分割一个窗体-例如,把 OptionButton 控件分成几组。
Frame1(0).Visible = False
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
DTPicker1(0).Value = Adodc1.Recordset.Fields("投诉时间")
DTPicker1(1).Value = Adodc1.Recordset.Fields("投诉时间")
Else
MsgBox "没有记录!", , "系统提示"
End If
End Sub
Private Sub Command4_Click() '上一个
Frame1(1).Visible = True
Frame1(0).Visible = False
' Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MovePrevious
On Error Resume Next
DTPicker1(0).Value = Adodc1.Recordset.Fields("投诉时间")
DTPicker1(1).Value = Adodc1.Recordset.Fields("投诉时间")
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveFirst
DTPicker1(0).Value = Adodc1.Recordset.Fields("投诉时间")
DTPicker1(1).Value = Adodc1.Recordset.Fields("投诉时间")
End If
Else
MsgBox "没有记录!", , "系统提示"
End If
End Sub
Private Sub Command5_Click() '下一个
Frame1(1).Visible = True
Frame1(0).Visible = False
' Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveNext
On Error Resume Next
DTPicker1(0).Value = Adodc1.Recordset.Fields("投诉时间")
DTPicker1(1).Value = Adodc1.Recordset.Fields("投诉时间")
DTPicker1(0).Value = Adodc1.Recordset.Fields("投诉时间")
DTPicker1(1).Value = Adodc1.Recordset.Fields("投诉时间")
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
DTPicker1(0).Value = Adodc1.Recordset.Fields("投诉时间")
DTPicker1(1).Value = Adodc1.Recordset.Fields("投诉时间")
End If
Else
MsgBox "没有记录!", , "系统提示"
End If
End Sub
Private Sub Command6_Click() '最后一个
Frame1(1).Visible = True
Frame1(0).Visible = False
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
DTPicker1(0).Value = Adodc1.Recordset.Fields("投诉时间")
DTPicker1(1).Value = Adodc1.Recordset.Fields("投诉时间")
Else
MsgBox "没有记录!", , "系统提示"
End If
End Sub
Private Sub Command7_Click() '取消
'清空文本框内容
Text1(0).Text = ""
Text2(0).Text = ""
Text3(0).Text = ""
Text5(0).Text = ""
Text6(0).Text = ""
Text7(0).Text = ""
Text8(0).Text = ""
Text9(0).Text = ""
Text10(0).Text = ""
Command1.Visible = True '添加按钮可见
Command2.Visible = False '保存按钮不可见
End Sub
Private Sub Command8_Click() '删除
Dim myval As String
Adodc1.RecordSource = "select * from tab_tsinfo"
If Adodc1.Recordset.RecordCount > 0 Then
myval = MsgBox("确定删除吗?", vbYesNo, "系统提示")
If myval = vbYes Then
Adodc1.Recordset.Delete
Unload Me
Adodc1.Refresh
Frm_xqtsinfo.Show
Else
End If
Else
MsgBox "数据库中没有记录要删除!", , "系统提示"
End If
Me.Refresh
End Sub
Private Sub Command9_Click() '浏览
frm_tsll.Show '显示投诉信息浏览窗体
End Sub
Private Sub Form_Load()
DTPicker1(0).Value = Date
'自动识别路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tab_tsinfo"
Adodc1.Refresh
Frame1(0).Visible = False
Frame1(1).Visible = True
DTPicker1(0).Value = Adodc1.Recordset.Fields("投诉时间")
DTPicker1(1).Value = Adodc1.Recordset.Fields("投诉时间")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -