📄 form61.frm
字号:
VERSION 5.00
Begin VB.Form Form61
BorderStyle = 4 'Fixed ToolWindow
Caption = "易耗品编码维护"
ClientHeight = 2235
ClientLeft = 45
ClientTop = 315
ClientWidth = 4680
LinkTopic = "Form6"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2235
ScaleWidth = 4680
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command4
Caption = "耗品编号"
Height = 375
Left = 240
TabIndex = 5
Top = 960
Width = 1335
End
Begin VB.CommandButton Command3
Caption = "耗品名称"
Height = 375
Left = 240
TabIndex = 4
Top = 360
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "关闭"
Height = 375
Left = 3600
TabIndex = 3
Top = 1680
Width = 975
End
Begin VB.CommandButton Command1
Caption = "保存"
Height = 375
Left = 2280
TabIndex = 2
Top = 1680
Width = 1215
End
Begin VB.TextBox Txtfield
Height = 375
Index = 1
Left = 1560
TabIndex = 1
Top = 960
Width = 2415
End
Begin VB.TextBox Txtfield
Height = 375
Index = 0
Left = 1560
TabIndex = 0
Top = 360
Width = 2415
End
End
Attribute VB_Name = "Form61"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'FIXIT: 使用 Option Explicit 可以避免隐式创建 Variant 类型的变量 FixIT90210ae-R383-H1984
Private Sub Command1_Click()
If Trim(txtfield(0).Text) = "" Then
MsgBox "对不起,名称必须输入? ", vbInformation, "Hello!"
txtfield(0).SetFocus
Exit Sub
End If
'FIXIT: 用 "Trim$" 函数替换 "Trim" 函数 FixIT90210ae-R9757-R1B8ZE
If Trim(txtfield(1).Text) = "" Then
MsgBox "对不起,编号必须输入? ", vbInformation, "Hello!"
txtfield(1).SetFocus
Exit Sub
End If
'开始保存内容
Dim db As Database
Dim EF As Recordset
Set db = OpenDatabase(ConData, False, False, Constr)
Set EF = db.OpenRecordset("Select * from yhbm", dbOpenDynaset)
'==================1
'FIXIT: 用 "Trim$" 函数替换 "Trim" 函数 FixIT90210ae-R9757-R1B8ZE
If Trim(txtfield(0).Text) <> "" Then
EF.AddNew
EF("名称") = txtfield(0).Text
EF("编号") = txtfield(1).Text
EF.Update
End If
'-----------------2
'-----------------
EF.Close
db.Close
MsgBox "编码已经录入 ", vbInformation
For i = 0 To 1
txtfield(i) = ""
Next
txtfield(0).SetFocus
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
'retValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, Me.CurrentX, Me.CurrentY, 11880, 8280, SWP_SHOWWINDOW)
sAppPath = App.Path
'FIXIT: 用 "Right$" 函数替换 "Right" 函数 FixIT90210ae-R9757-R1B8ZE
If Right(App.Path, 1) = "\" Then
sAppPath = App.Path
Else
sAppPath = App.Path & "\"
End If
End Sub
Private Sub txtField_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 38 Then
'自动上移
If Index > 0 Then '最后一个文本框
txtfield(Index - 1).SetFocus
Else
txtfield(1).SetFocus '返回
End If
Exit Sub
End If
If KeyCode = 40 Then
'自动下跳
If Index < 1 Then '最后一个文本框
txtfield(Index + 1).SetFocus
Else
txtfield(0).SetFocus '返回
End If
Exit Sub
End If
End Sub
Private Sub txtField_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
'自动下跳
If Index < 1 Then '最后一个文本框
txtfield(Index + 1).SetFocus
Else
txtfield(0).SetFocus '返回
End If
Exit Sub
End If
'判断是否为正确输入
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -