📄 delws.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form delws
BorderStyle = 4 'Fixed ToolWindow
Caption = "删除卫生记录"
ClientHeight = 3645
ClientLeft = 45
ClientTop = 285
ClientWidth = 3285
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3645
ScaleWidth = 3285
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin MSAdodcLib.Adodc Adodc3
Height = 375
Left = 3600
Top = 2400
Visible = 0 'False
Width = 2295
_ExtentX = 4048
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
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 = "Adodc3"
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 MSAdodcLib.Adodc Adodc2
Height = 375
Left = 3600
Top = 2040
Visible = 0 'False
Width = 2295
_ExtentX = 4048
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
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 = "Adodc2"
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 MSAdodcLib.Adodc Adodc1
Height = 375
Left = 3600
Top = 1680
Visible = 0 'False
Width = 2295
_ExtentX = 4048
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
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 Frame4
Caption = "提示"
ForeColor = &H000000FF&
Height = 3615
Left = 0
TabIndex = 0
Top = 0
Width = 3255
Begin VB.Frame Frame6
Height = 1455
Left = 120
TabIndex = 20
Top = 2040
Width = 3015
Begin VB.ComboBox Combo2
Height = 300
Left = 1200
TabIndex = 23
Top = 280
Width = 1455
End
Begin VB.CommandButton Command5
Caption = "确定"
Height = 375
Left = 960
TabIndex = 22
Top = 840
Width = 735
End
Begin VB.CommandButton Command6
Caption = "取消"
Height = 375
Left = 1920
TabIndex = 21
Top = 840
Width = 735
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "删除日期"
Height = 180
Left = 240
TabIndex = 24
Top = 360
Width = 720
End
End
Begin VB.Frame Frame5
Height = 1455
Left = 120
TabIndex = 16
Top = 2040
Width = 3015
Begin VB.CommandButton Command3
Caption = "确定"
Height = 375
Left = 960
TabIndex = 18
Top = 840
Width = 735
End
Begin VB.CommandButton Command4
Caption = "取消"
Height = 375
Left = 1920
TabIndex = 17
Top = 840
Width = 735
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "此操作将把卫生记录全部删除"
Height = 180
Left = 240
TabIndex = 19
Top = 360
Width = 2340
End
End
Begin VB.Frame Frame3
Height = 1455
Left = 120
TabIndex = 6
Top = 2040
Width = 3015
Begin VB.TextBox Text2
Height = 270
Left = 600
TabIndex = 14
Top = 960
Width = 1215
End
Begin VB.TextBox Text1
Height = 270
Left = 600
TabIndex = 13
Top = 600
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
Left = 600
TabIndex = 9
Top = 240
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 2040
TabIndex = 8
Top = 360
Width = 735
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2040
TabIndex = 7
Top = 840
Width = 735
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "日期"
Height = 180
Left = 120
TabIndex = 12
Top = 285
Width = 360
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "公寓"
Height = 180
Left = 120
TabIndex = 11
Top = 645
Width = 360
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "寝室"
Height = 180
Left = 120
TabIndex = 10
Top = 1005
Width = 360
End
End
Begin VB.Frame Frame2
Height = 855
Left = 120
TabIndex = 3
Top = 1200
Width = 3015
Begin VB.OptionButton Option3
Caption = "批量"
Height = 285
Left = 1080
TabIndex = 15
Top = 300
Width = 700
End
Begin VB.OptionButton Option1
Caption = "单条"
Height = 285
Left = 240
TabIndex = 5
Top = 300
Width = 700
End
Begin VB.OptionButton Option2
Caption = "全部"
Height = 285
Left = 1920
TabIndex = 4
Top = 300
Width = 700
End
End
Begin VB.Frame Frame1
ForeColor = &H000000FF&
Height = 975
Left = 120
TabIndex = 1
Top = 240
Width = 3015
Begin VB.Label Label1
Caption = "删除前确定当前数据库已备份可以选择单条删除与批量删除"
Height = 420
Left = 360
TabIndex = 2
Top = 360
Width = 2415
End
End
End
End
Attribute VB_Name = "delws"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error Resume Next
Dim sql As String
Dim s As String
Dim panduan As Boolean
If Combo1.Text = "" And Text1.Text = "" And Text2.Text = "" Then
MsgBox "请输入删除条件!", , "提示"
Exit Sub
End If
s = Combo1.Text
If (MsgBox("你真的想删除日期为 " & Combo1.Text & " 公寓为 " & Text1.Text & " 寝室为 " & Text2.Text & " 的记录吗?", vbOKCancel, "系统提示")) = vbOK Then
Adodc1.Refresh
Adodc1.Recordset.ActiveConnection.Execute "delete from weisheng where 日期='" & Trim(s) & "'and 公寓='" & Trim(Text1.Text) & "'and 寝室='" & Trim(Text2.Text) & "'" ', , adExecuteNoRecords
Adodc1.Recordset.Update
Combo1.Text = ""
Text1.Text = ""
Text2.Text = ""
MsgBox "删除成功", , "系统提示"
End If
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
On Error Resume Next
If (MsgBox("你真的想删除所有的记录吗?一旦删除即不可恢复", vbOKCancel, "系统提示")) = vbOK Then
For I = 1 To Adodc1.Recordset.RecordCount
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
Next I
End If
MsgBox "删除成功", , "系统提示"
Unload Me
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command5_Click()
On Error Resume Next
If (MsgBox("你真的想删除日期为 " & Combo2.Text & " 的记录吗?", vbOKCancel, "系统提示")) = vbOK Then
Adodc1.Refresh
Adodc1.Recordset.ActiveConnection.Execute "delete from weisheng where 日期='" & Trim(Combo2.Text) & "'"
Combo2.Text = ""
MsgBox "删除成功", , "系统提示"
End If
Unload Me
End Sub
Private Sub Command6_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error Resume Next
provider = "provider=Microsoft.jet.oledb.4.0"
datasource = "data source=" & App.Path & "\DB.mdb"
With Adodc1
.Mode = adModeReadWrite
.ConnectionString = provider & ";" & datasource
.CommandType = adCmdTable
.RecordSource = "weisheng"
.Refresh
End With
s = "select distinct 日期 from weisheng"
With Adodc2
.Mode = adModeReadWrite
.ConnectionString = provider & ";" & datasource
.CommandType = adCmdText
.RecordSource = s
.Refresh
End With
For I = 1 To Adodc2.Recordset.RecordCount
Combo1.AddItem (Adodc2.Recordset.Fields("日期"))
Combo2.AddItem (Adodc2.Recordset.Fields("日期"))
Adodc2.Recordset.MoveNext
Next
Option1.Value = True
Frame3.Visible = True
Frame5.Visible = False
Frame6.Visible = False
End Sub
Private Sub Option1_Click()
Frame3.Visible = True
Frame5.Visible = False
Frame6.Visible = False
End Sub
Private Sub Option2_Click()
Frame3.Visible = False
Frame5.Visible = True
Frame6.Visible = False
End Sub
Private Sub Option3_Click()
Frame3.Visible = False
Frame5.Visible = False
Frame6.Visible = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -