?? frmuseexpendable.frm
字號:
VERSION 5.00
Begin VB.Form frmUseExpendable
BorderStyle = 1 'Fixed Single
Caption = "消耗品領用"
ClientHeight = 3825
ClientLeft = 45
ClientTop = 330
ClientWidth = 5625
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3825
ScaleWidth = 5625
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 3840
TabIndex = 7
Top = 3000
Width = 975
End
Begin VB.CommandButton cmdModi
Caption = "領用"
Height = 375
Left = 720
TabIndex = 6
Top = 3000
Width = 975
End
Begin VB.CommandButton cmdSearch
Caption = "查詢"
Height = 375
Left = 2280
TabIndex = 5
Top = 3000
Width = 975
End
Begin VB.Frame Frame1
Height = 2175
Left = 480
TabIndex = 0
Top = 360
Width = 4455
Begin VB.TextBox txtECount
Appearance = 0 'Flat
Height = 375
Left = 1800
MaxLength = 5
TabIndex = 2
Top = 1200
Width = 1575
End
Begin VB.TextBox txtEName
Appearance = 0 'Flat
Height = 375
Left = 1800
MaxLength = 10
TabIndex = 1
Top = 480
Width = 1575
End
Begin VB.Label Label6
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "數量:"
BeginProperty Font
Name = "楷體_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 285
Left = 840
TabIndex = 4
Top = 1200
Width = 945
End
Begin VB.Label Label1
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "名稱:"
BeginProperty Font
Name = "楷體_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 285
Left = 840
TabIndex = 3
Top = 480
Width = 945
End
End
End
Attribute VB_Name = "frmUseExpendable"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'ENAME Not VarChar(30), --消耗品名稱
'price Not Money, --價格
'ECOUNT INT NULL, --數量
'STOREID CHAR(1) REFERENCES STORE(STOREID)) --存儲地點
Private objExpendable As New clsExpendable
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdModi_Click()
'修改消耗品
If checkForm() Then
Call getFormValues
If objExpendable.Use() Then
MsgBox "數據修改成功!"
Else
MsgBox "數據修改失敗!"
End If
End If
Call resetForm(Me)
End Sub
Private Sub cmdSearch_Click()
'查詢消耗品
Dim strCondition As String
Dim rsq As New ADODB.Recordset
Dim i As Integer
If Trim(Me.txtEName.Text) = "" Then
MsgBox "請填寫消耗品名稱!"
Me.txtEName.SetFocus
Exit Sub
End If
objExpendable.ENAME = Trim(Me.txtEName.Text)
strCondition = "EName='" & Trim(Me.txtEName.Text) & "'"
Set rsq = objDBOpt.getRecord("Expendable", "*", strCondition)
If rsq Is Nothing Then
MsgBox "查詢失敗!"
ElseIf rsq.EOF And rsq.BOF Then
MsgBox "沒有符合條件的記錄!"
Else
Me.txtECount.Text = setNotNull(rsq.Fields("ECount").Value, 0)
End If
End Sub
Private Sub Form_Load()
Call resetForm(Me)
End Sub
Private Sub getFormValues()
objExpendable.ENAME = Me.txtEName.Text
objExpendable.ECOUNT = Me.txtECount.Text
End Sub
Private Function checkForm() As Boolean
If Trim(Me.txtEName.Text) = "" Then
MsgBox "消耗品名稱不能為空!"
Me.txtEName.SetFocus
checkForm = False
Exit Function
End If
If IsNumeric(Me.txtECount.Text) = False Or InStr(1, Me.txtECount.Text, ".") > 0 Or InStr(1, Me.txtECount.Text, "-") > 0 Then
MsgBox "消耗品數量應該為整數!"
Me.txtECount.SetFocus
checkForm = False
Exit Function
End If
checkForm = True
End Function
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -