📄 frmcancelinfoedit.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmCancelInfoEdit
BorderStyle = 1 'Fixed Single
Caption = "Form1"
ClientHeight = 2460
ClientLeft = 45
ClientTop = 330
ClientWidth = 4860
KeyPreview = -1 'True
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 164
ScaleMode = 3 'Pixel
ScaleWidth = 324
StartUpPosition = 1 '所有者中心
Begin VB.TextBox txtBookNo
Height = 300
Left = 1200
MaxLength = 8
TabIndex = 0
Text = "Text1"
Top = 120
Width = 1800
End
Begin VB.CommandButton cmdOk
Caption = "确定(&O)"
Height = 375
Left = 3360
TabIndex = 7
TabStop = 0 'False
Top = 1320
Width = 1215
End
Begin VB.CommandButton cmdCancel
Caption = "取消(&C)"
Height = 375
Left = 3360
TabIndex = 6
TabStop = 0 'False
Top = 1830
Width = 1215
End
Begin MSComCtl2.DTPicker dtpCancelDate
Height = 300
Left = 1200
TabIndex = 2
TabStop = 0 'False
Top = 1320
Width = 1800
_ExtentX = 3175
_ExtentY = 529
_Version = 393216
Format = 27000833
CurrentDate = 37917
End
Begin VB.TextBox txtPayMoney
Height = 300
Left = 1200
MaxLength = 5
TabIndex = 1
Text = "Text3"
Top = 1920
Width = 1800
End
Begin MSComCtl2.DTPicker dtpBookDate
Height = 300
Left = 1200
TabIndex = 8
TabStop = 0 'False
Top = 720
Width = 1800
_ExtentX = 3175
_ExtentY = 529
_Version = 393216
Enabled = 0 'False
Format = 27000833
CurrentDate = 37917
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "登记日期:"
Height = 180
Left = 345
TabIndex = 9
Top = 720
Width = 900
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "退房日期:"
Height = 180
Left = 345
TabIndex = 5
Top = 1320
Width = 900
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "付款金额:"
Height = 180
Left = 345
TabIndex = 4
Top = 1920
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "登记号:"
Height = 180
Left = 525
TabIndex = 3
Top = 240
Width = 720
End
End
Attribute VB_Name = "frmCancelInfoEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim blnStartSelect As Boolean
Private Sub cmdCancel_Click()
'退出窗体
Unload Me
End Sub
Private Sub cmdOk_Click()
With frmMDI.adoCancel.Recordset
If Not txtBookNo.Locked Then '可修改状态表示是添加记录
If Trim(txtBookNo.Text) = "" Then
MsgBox "登记号不能为空!", vbOKOnly + vbInformation, "提示"
txtBookNo.SetFocus
Exit Sub
End If
frmMDI.adoGuest.Recordset.Find "BookNo='" & Trim(txtBookNo.Text) & "'", , adSearchForward, 1
If frmMDI.adoGuest.Recordset.EOF Then '有就提示,然后退出
MsgBox "非法登记号!", vbOKOnly + vbInformation, "提示"
txtBookNo.SetFocus
SendKeys "{HOME}+{END}"
txtPayMoney.Text = ""
Exit Sub
End If
frmMDI.adoCancel.Recordset.Find "BookNo='" & Trim(txtBookNo.Text) & "'", , adSearchForward, 1
If Not frmMDI.adoCancel.Recordset.EOF Then '有就提示,然后退出
MsgBox "已经有相同登记号!", vbOKOnly + vbInformation, "提示"
txtBookNo.SetFocus
SendKeys "{HOME}+{END}"
txtPayMoney.Text = ""
Exit Sub
End If
'没有就添加记录
.AddNew
!BookNo = Trim(txtBookNo.Text)
End If
'给字段赋值
!PayMoney = Val(Trim(txtPayMoney.Text))
!CancelDate = dtpCancelDate.Value
.Update
'退出窗体
Unload Me
End With
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{TAB}"
End If
End Sub
Private Sub Form_Load()
Me.Left = (frmMDI.Width - Me.Width) / 2
Me.Top = (frmMDI.Height - Me.Height) / 4
End Sub
Private Sub txtBookNo_Change()
If Not blnStartSelect Then
Exit Sub
End If
frmMDI.adoGuest.Recordset.Find "BookNo='" & Trim(txtBookNo.Text) & "'", , adSearchForward, 1
If Not frmMDI.adoGuest.Recordset.EOF Then
dtpBookDate.Value = frmMDI.adoGuest.Recordset!BookDate
End If
End Sub
Private Sub txtBookNo_GotFocus()
blnStartSelect = True
End Sub
Private Sub txtBookNo_KeyPress(KeyAscii As Integer)
'只允许输入数字和退格键
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub
Private Sub txtBookNo_LostFocus()
blnStartSelect = False
End Sub
Private Sub txtPayMoney_GotFocus()
txtPayMoney.Text = Str(frmMDI.adoRoom.Recordset!RoomRate * (dtpCancelDate.Value - dtpBookDate.Value))
End Sub
Private Sub txtPayMoney_KeyPress(KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -