📄 edrec1.frm
字号:
VERSION 5.00
Begin VB.Form edrec1
Caption = "记录编辑"
ClientHeight = 2535
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 2535
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2640
TabIndex = 4
Top = 1800
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 960
TabIndex = 3
Top = 1800
Width = 1095
End
Begin VB.Frame Frame1
Caption = "记录编辑"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1095
Left = 480
TabIndex = 0
Top = 360
Width = 3735
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1680
TabIndex = 2
Top = 360
Width = 1815
End
Begin VB.Label Label1
Caption = "Label1"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 1
Top = 360
Width = 1095
End
End
End
Attribute VB_Name = "edrec1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cond As String
Private Sub Command1_Click()
If Trim(Text1.Text) = "" Then
MsgBox "数据项不能为空,请重新设置", vbOKOnly, "信息提示"
Text1.SetFocus
Exit Sub
End If
If flag = 1 Then
If edrec.Adodc1.Recordset.RecordCount > 0 Then
cond = "fn='" + Trim(Text1.Text) + "'"
edrec.Adodc1.Recordset.MoveFirst
edrec.Adodc1.Recordset.Find (cond)
If Not edrec.Adodc1.Recordset.EOF() Then
MsgBox "存在完全相同的记录", vbOKOnly, "信息提示"
Text1.SetFocus
Exit Sub
End If
End If
edrec.Adodc1.Recordset.AddNew
edrec.Adodc1.Recordset.Fields("fn") = Trim(Text1.Text)
edrec.Adodc1.Recordset.Update
recs = recs + 1
Else
n = edrec.Adodc1.Recordset.AbsolutePosition
cond = "fn='" + Trim(Text1.Text) + "'"
edrec.Adodc1.Recordset.MoveFirst
edrec.Adodc1.Recordset.Find (cond)
If Not edrec.Adodc1.Recordset.EOF() And edrec.Adodc1.Recordset.AbsolutePosition <> n Then
MsgBox "存在完全相同的记录", vbOKOnly, "信息提示"
edrec.Adodc1.Recordset.MoveFirst
edrec.Adodc1.Recordset.Move (n - 1)
Text1.SetFocus
Exit Sub
End If
edrec.Adodc1.Recordset.MoveFirst
edrec.Adodc1.Recordset.Move (n - 1)
edrec.Adodc1.Recordset.Fields("fn") = Trim(Text1.Text)
edrec.Adodc1.Recordset.Update
End If
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Label1.Caption = cap
If flag = 1 Then
Text1.Text = ""
Else
Text1.Text = edrec.Adodc1.Recordset.Fields("fn")
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -