📄 frmmodifyreserve.frm
字号:
VERSION 5.00
Begin VB.Form frmModifyReserve
BorderStyle = 1 'Fixed Single
Caption = "编辑预订信息"
ClientHeight = 5280
ClientLeft = 45
ClientTop = 330
ClientWidth = 7395
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5280
ScaleWidth = 7395
Begin VB.TextBox txtTime
Height = 375
Left = 5040
TabIndex = 22
Top = 1320
Width = 1935
End
Begin VB.OptionButton OpP
Caption = "下"
Height = 255
Left = 2520
TabIndex = 15
Top = 2040
Width = 615
End
Begin VB.OptionButton OpA
Caption = "上"
Height = 255
Left = 1680
TabIndex = 14
Top = 2040
Value = -1 'True
Width = 615
End
Begin VB.TextBox txtPhone
Height = 372
Left = 5040
TabIndex = 13
Top = 720
Width = 1935
End
Begin VB.TextBox txtDeskNO
Height = 372
Left = 1530
TabIndex = 12
Top = 1365
Width = 1935
End
Begin VB.TextBox txtComment
Height = 375
Left = 5040
ScrollBars = 2 'Vertical
TabIndex = 11
Top = 1920
Width = 1995
End
Begin VB.TextBox txtReserveName
Height = 375
Left = 1560
TabIndex = 10
Top = 720
Width = 1935
End
Begin VB.Frame Frame3
Caption = "修改房屋信息"
Height = 1092
Left = 360
TabIndex = 5
Top = 3960
Width = 6855
Begin VB.CommandButton editCommand
Caption = "修改记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 270
TabIndex = 9
Top = 390
Width = 1350
End
Begin VB.CommandButton updateCommand
Caption = "保存记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 1755
TabIndex = 8
Top = 390
Width = 1455
End
Begin VB.CommandButton cancelCommand
Caption = "关闭退出"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 5040
TabIndex = 7
Top = 390
Width = 1575
End
Begin VB.CommandButton deleteCommand
Caption = "删除记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 3345
TabIndex = 6
Top = 390
Width = 1560
End
End
Begin VB.Frame Frame2
Caption = "查看房屋信息"
Height = 1092
Left = 360
TabIndex = 0
Top = 2640
Width = 6855
Begin VB.CommandButton firstCommand
Caption = "第一条记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 240
TabIndex = 4
Top = 360
Width = 1452
End
Begin VB.CommandButton previousCommand
Caption = "上一条记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 1800
TabIndex = 3
Top = 360
Width = 1452
End
Begin VB.CommandButton nextCommand
Caption = "下一条记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 3360
TabIndex = 2
Top = 360
Width = 1452
End
Begin VB.CommandButton lastCommand
Caption = "最后一条记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 4920
TabIndex = 1
Top = 360
Width = 1692
End
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "电话:"
Height = 255
Left = 3840
TabIndex = 21
Top = 720
Width = 1095
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "上下午:"
Height = 255
Left = 120
TabIndex = 20
Top = 2130
Width = 1410
End
Begin VB.Label Label5
Alignment = 2 'Center
Caption = "桌位号:"
Height = 255
Left = 345
TabIndex = 19
Top = 1410
Width = 975
End
Begin VB.Label Label9
Alignment = 2 'Center
Caption = "备注:"
Height = 375
Left = 3840
TabIndex = 18
Top = 1920
Width = 1095
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "预订人:"
Height = 255
Left = 0
TabIndex = 17
Top = 720
Width = 1665
End
Begin VB.Label Label3
Caption = "时间:"
Height = 375
Left = 4080
TabIndex = 16
Top = 1320
Width = 615
End
End
Attribute VB_Name = "frmModifyReserve"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mrc As ADODB.Recordset
Dim myBookmark As Variant
Dim mcclean As Boolean
Private Sub cancelCommand_Click()
Unload Me
End Sub
Private Sub deleteCommand_Click()
myBookmark = mrc.Bookmark
If MsgBox("是否删除当前记录?", vbOKCancel, "删除当前记录") = vbOK Then
mrc.MoveNext
If mrc.EOF Then
mrc.MoveFirst
myBookmark = mrc.Bookmark
mrc.MoveLast
mrc.Delete
mrc.Bookmark = myBookmark
Call viewData
Else
myBookmark = mrc.Bookmark
mrc.MovePrevious
mrc.Delete
mrc.Bookmark = myBookmark
Call viewData
End If
Else
mrc.Bookmark = myBookmark
Call viewData
End If
End Sub
Private Sub editCommand_Click()
mcclean = False
Frame2.Enabled = False
firstCommand.Enabled = False
previousCommand.Enabled = False
nextCommand.Enabled = False
lastCommand.Enabled = False
txtReserveName.Enabled = True
txtPhone.Enabled = True
' txtDeskNO.Enabled = True
'txtTime.Enabled = True
'OpA.Enabled = True
' OpP.Enabled = True
txtComment.Enabled = True
myBookmark = mrc.Bookmark
End Sub
Private Sub firstCommand_Click()
mrc.MoveFirst
Call viewData
End Sub
Private Sub Form_Load()
Dim txtSQL As String
Dim MsgText As String
txtSQL = "select * from 预订信息"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.MoveFirst
Call viewData
myBookmark = mrc.Bookmark
mcclean = True
txtReserveName.Enabled = False
txtPhone.Enabled = False
txtDeskNO.Enabled = False
txtTime.Enabled = False
OpA.Enabled = False
OpP.Enabled = False
txtComment.Enabled = False
End Sub
Public Sub viewData()
txtReserveName.Text = mrc.Fields(1)
txtPhone.Text = mrc.Fields(2)
txtDeskNO.Text = mrc.Fields(3)
txtTime.Text = mrc.Fields(4)
If mrc.Fields(5) <> 0 Then
OpA.Value = True
Else
OpP.Value = True
End If
txtComment.Text = mrc.Fields(6)
End Sub
Private Sub lastCommand_Click()
mrc.MoveLast
Call viewData
End Sub
Private Sub nextCommand_Click()
mrc.MoveNext
If mrc.EOF Then
mrc.MoveFirst
End If
Call viewData
End Sub
Private Sub previousCommand_Click()
mrc.MovePrevious
If mrc.BOF Then
mrc.MoveLast
End If
Call viewData
End Sub
Private Sub updateCommand_Click()
Dim txtSQL As String
Dim MsgText As String
Dim mrcc As ADODB.Recordset
If Not Testtxt(txtReserveName.Text) Then
MsgBox "请输入预订人姓名!", vbOKOnly + vbExclamation, "警告"
txtReserveName.SetFocus
Exit Sub
End If
If Not Testtxt(txtPhone.Text) Then
MsgBox "请输入预订人联系电话!", vbOKOnly + vbExclamation, "警告"
txtPhone.SetFocus
Exit Sub
End If
mrc.Fields(1) = Trim(txtReserveName.Text)
mrc.Fields(2) = Trim(txtPhone.Text)
mrc.Fields(3) = Trim(txtDeskNO.Text)
mrc.Fields(4) = CDate(txtTime.Text)
If OpA.Value = True Then
mrc.Fields(5) = 1
Else
mrc.Fields(5) = 0
End If
mrc.Fields(6) = Trim(txtComment.Text)
mrc.Fields(7) = UserName
mrc.Fields(8) = CStr(Date)
mrc.Update
MsgBox "预订信息更新成功!", vbOKOnly + vbExclamation, "更新预订信息"
mrc.Bookmark = myBookmark
Call viewData
Frame2.Enabled = True
firstCommand.Enabled = True
previousCommand.Enabled = True
nextCommand.Enabled = True
lastCommand.Enabled = True
txtReserveName.Enabled = False
txtPhone.Enabled = False
' txtDeskNO.Enabled = False
'txtTime.Enabled = False
' OpA.Enabled = False
' OpP.Enabled = False
txtComment.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -