📄 frmoutstoragetype.frm
字号:
VERSION 5.00
Begin VB.Form frmOutStorageType
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
BorderStyle = 1 'Fixed Single
Caption = "出库类型管理"
ClientHeight = 2145
ClientLeft = 45
ClientTop = 330
ClientWidth = 3465
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2145
ScaleWidth = 3465
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdExit
Appearance = 0 'Flat
Height = 435
Left = 1920
Picture = "frmOutStorageType.frx":0000
Style = 1 'Graphical
TabIndex = 5
Top = 1320
Width = 960
End
Begin VB.CommandButton cmdSave
Appearance = 0 'Flat
Height = 435
Left = 600
Picture = "frmOutStorageType.frx":14E4
Style = 1 'Graphical
TabIndex = 2
Top = 1320
Width = 945
End
Begin VB.TextBox TxtFields
Appearance = 0 'Flat
Height = 375
Index = 1
Left = 1440
TabIndex = 1
Top = 600
Width = 1695
End
Begin VB.TextBox TxtFields
Appearance = 0 'Flat
Height = 375
Index = 0
Left = 1440
TabIndex = 0
Top = 120
Width = 1695
End
Begin VB.Label Label2
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "出库类型"
ForeColor = &H80000008&
Height = 255
Left = 240
TabIndex = 4
Top = 720
Width = 1095
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "出库类型编号"
ForeColor = &H80000008&
Height = 255
Left = 240
TabIndex = 3
Top = 240
Width = 1095
End
End
Attribute VB_Name = "frmOutStorageType"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public blnAddNew As Boolean
Public intFlag As Integer
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub CmdSave_Click()
Dim sqlstring As String
Dim rstmp As New ADODB.Recordset
On Error GoTo SaveErr
If blnAddNew Then
If Trim(TxtFields(0).Text) = "" Or Trim(TxtFields(1).Text) = "" Then
MsgBox "编码、名称不能为空!", vbInformation
Exit Sub
End If
If CheckExist Then
MsgBox "此出库类型编码已存在,请修改。", vbInformation + vbOKOnly
Call setselect(TxtFields(0))
Exit Sub
End If
sqlstring = "Insert into OutStorageType (ChrOutStorageNo,ChrOutStorageName) values ('" & TxtFields(0).Text & "','" & TxtFields(1).Text & _
"')"
cN.BeginTrans
cN.Execute (sqlstring)
cN.CommitTrans
Unload Me
Call frmFields.cmdRefresh_Click
Else
If Trim(TxtFields(0).Text) = "" Or Trim(TxtFields(1).Text) = "" Then
MsgBox "编码、名称不能为空!", vbInformation
Exit Sub
End If
sqlstring = "Update OutStorageType set ChrOutStorageName='" & TxtFields(1).Text & "' " & _
"where ChrOutStorageNo='" & Trim(TxtFields(0).Text) & "'"
cN.BeginTrans
cN.Execute (sqlstring)
cN.CommitTrans
Unload Me
Call frmFields.cmdRefresh_Click
End If
Exit Sub
SaveErr:
cN.RollbackTrans
MsgBox "保存记录失败:" & err.Description, vbInformation
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Call autoreturn(KeyCode)
End Sub
Private Function CheckExist() As Boolean
Dim sqlstring As String
Dim rstmp As New ADODB.Recordset
On Error GoTo err
sqlstring = "select * from OutStorageType where ChrOutStorageNo='" & Trim(TxtFields(0).Text) & "'"
rstmp.Open sqlstring, cN, adOpenKeyset, adLockReadOnly
If rstmp.EOF Then
CheckExist = False
Else
CheckExist = True
End If
Exit Function
err:
MsgBox "打开记录失败:" & err.Description, vbInformation
End Function
Private Sub TxtFields_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
SendKeys "{TAB}"
Exit Sub
End If
End Sub
Private Sub txtFields_KeyPress(Index As Integer, KeyAscii As Integer)
Select Case Index
Case 0
KeyAscii = ValiText(KeyAscii, vbExpInteger, "", TxtFields(Index).Text, 2)
' Case 2
' KeyAscii = ValiText(KeyAscii, vbExpDecimal, "", TxtFields(Index).Text)
' Case 4
' KeyAscii = ValiText(KeyAscii, vbExpInteger, "", TxtFields(Index).Text)
' Case 5
' KeyAscii = ValiText(KeyAscii, vbExpDecimal, "", TxtFields(Index).Text)
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -