📄 form29.frm
字号:
VERSION 5.00
Begin VB.Form Form29
BorderStyle = 3 'Fixed Dialog
Caption = "Form29"
ClientHeight = 5340
ClientLeft = 45
ClientTop = 330
ClientWidth = 6450
LinkTopic = "Form29"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5340
ScaleWidth = 6450
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "保存数据"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2160
TabIndex = 5
Top = 3840
Width = 1695
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2880
TabIndex = 1
Top = 2640
Width = 1695
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2880
TabIndex = 2
Top = 1800
Width = 1695
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "帐本号输入画面"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 2160
TabIndex = 4
Top = 720
Width = 1995
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "帐 本 号:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 1320
TabIndex = 3
Top = 2640
Width = 1440
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "使用年份:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 1320
TabIndex = 0
Top = 1800
Width = 1425
End
End
Attribute VB_Name = "Form29"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox ("没有输入数据不能保存")
Text1.SetFocus
GoSub exit_command1_click
End If
Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command
Dim rs1 As ADODB.Recordset
Set cnn1 = New ADODB.Connection
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\jujumao\My Documents\粤丰饲料\粤丰饲料经营情况.mdb;"
Set cmd1 = New ADODB.Command
SQL = "select count(*) from 帐本表 where 使用年份= " & Text1.Text & " and 帐本号 =" & "'" & _
Text2.Text & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
rs1.MoveFirst
If rs1.Fields(0) = 1 Then
MsgBox ("该项目已输入")
cnn1.Close
Set cnn1 = Nothing
Text1.Text = ""
Text1.SetFocus
GoSub exit_command1_click
End If
SQL = "INSERT INTO 帐本表 VALUES ( " & Text1.Text & "," & "'" & Text2.Text & "'" & ")"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
.Execute
End With
MsgBox ("数据保存成功")
cnn1.Close
Set cnn1 = Nothing
Text2.Text = ""
Text2.SetFocus
exit_command1_click:
End Sub
Private Sub Form_Load()
Text1.Text = Year(Date)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form2.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -