📄 frmaddreserve.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form frmAddReserve
BorderStyle = 1 'Fixed Single
Caption = "添加订单"
ClientHeight = 3630
ClientLeft = 45
ClientTop = 330
ClientWidth = 7170
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3630
ScaleWidth = 7170
Begin MSComCtl2.DTPicker DTReserve
Height = 375
Left = 5040
TabIndex = 14
Top = 1080
Width = 1695
_ExtentX = 2990
_ExtentY = 661
_Version = 393216
Format = 72351745
CurrentDate = 37903
End
Begin VB.TextBox txtReserveName
Height = 375
Left = 1440
TabIndex = 12
Top = 600
Width = 1695
End
Begin VB.TextBox txtComment
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5040
ScrollBars = 2 'Vertical
TabIndex = 6
Top = 1920
Width = 1665
End
Begin VB.TextBox txtDeskNO
Height = 372
Left = 1410
TabIndex = 5
Top = 1245
Width = 1692
End
Begin VB.TextBox txtPhone
Height = 372
Left = 5040
TabIndex = 4
Top = 480
Width = 1692
End
Begin VB.CommandButton updateCommand
Caption = "保存记录"
Height = 492
Left = 1680
TabIndex = 3
Top = 2880
Width = 1095
End
Begin VB.CommandButton cancelCommand
Caption = "关闭退出"
Height = 492
Left = 4440
TabIndex = 2
Top = 2880
Width = 1215
End
Begin VB.OptionButton OpA
Caption = "上"
Height = 255
Left = 1680
TabIndex = 1
Top = 2010
Value = -1 'True
Width = 615
End
Begin VB.OptionButton OpP
Caption = "下"
Height = 255
Left = 2520
TabIndex = 0
Top = 2010
Width = 615
End
Begin VB.Label Label3
Caption = "时间:"
Height = 375
Left = 3960
TabIndex = 13
Top = 1200
Width = 615
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "预订人:"
Height = 255
Left = 0
TabIndex = 11
Top = 600
Width = 1665
End
Begin VB.Label Label9
Alignment = 2 'Center
Caption = "备注:"
Height = 375
Left = 3720
TabIndex = 10
Top = 1920
Width = 1095
End
Begin VB.Label Label5
Alignment = 2 'Center
Caption = "桌位号:"
Height = 255
Left = 225
TabIndex = 9
Top = 1290
Width = 975
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "上下午:"
Height = 255
Left = 120
TabIndex = 8
Top = 2010
Width = 1410
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "电话:"
Height = 255
Left = 3660
TabIndex = 7
Top = 480
Width = 1095
End
End
Attribute VB_Name = "frmAddReserve"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cancelCommand_Click()
Unload Me
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
If Not Testtxt(txtDeskNO.Text) Then
MsgBox "请输入桌位编号!", vbOKOnly + vbExclamation, "警告"
txtDeskNO.SetFocus
Exit Sub
End If
If OpA.Value = True Then
txtSQL = "select * from 预订信息 where 桌位编号 = '" & Trim(txtDeskNO.Text) & "' and 时间 = '" & DTReserve.Value & "' and 上下午 <> 0"
Else
txtSQL = "select * from 预订信息 where 桌位编号 = '" & Trim(txtDeskNO.Text) & "' and 时间 = '" & DTReserve.Value & "' and 上下午 = 0"
End If
Set mrcc = ExecuteSQL(txtSQL, MsgText)
If mrcc.EOF = False Then
MsgBox "该桌位号已被预订,请重新输入!", vbOKOnly + vbExclamation, "警告"
mrcc.Close
txtReserveName.SetFocus
Else
mrcc.AddNew
mrcc.Fields(1) = Trim(txtReserveName.Text)
mrcc.Fields(2) = Trim(txtPhone.Text)
mrcc.Fields(3) = Trim(txtDeskNO.Text)
mrcc.Fields(4) = DTReserve.Value
If OpA.Value = True Then
mrcc.Fields(5) = 1
Else
mrcc.Fields(5) = 0
End If
mrcc.Fields(6) = Trim(txtComment.Text)
mrcc.Fields(7) = UserName
mrcc.Fields(8) = CStr(Date)
mrcc.Update
MsgBox "预订信息添加成功!", vbOKOnly + vbExclamation, "添加预订信息"
mrcc.Close
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -