📄 form42.frm
字号:
VERSION 5.00
Begin VB.Form Form42
BorderStyle = 3 'Fixed Dialog
Caption = "Form42"
ClientHeight = 3450
ClientLeft = 45
ClientTop = 330
ClientWidth = 5595
LinkTopic = "Form42"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3450
ScaleWidth = 5595
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 = 1800
TabIndex = 8
Top = 2760
Width = 2055
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 1800
TabIndex = 6
Text = "Combo1"
Top = 2160
Width = 2415
End
Begin VB.TextBox Text3
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 440
Left = 1800
TabIndex = 4
Top = 1560
Width = 2370
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 = 440
Left = 1800
TabIndex = 2
Top = 960
Width = 2370
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 = 440
Left = 1800
TabIndex = 0
Top = 360
Width = 2370
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "品 种:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 720
TabIndex = 7
Top = 2160
Width = 840
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "年 份:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 720
TabIndex = 5
Top = 1680
Width = 960
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "帐单号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 720
TabIndex = 3
Top = 1080
Width = 960
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "帐本号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 720
TabIndex = 1
Top = 480
Width = 960
End
End
Attribute VB_Name = "Form42"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Combo1.Text = "" Then
MsgBox ("品种不能为空!")
Combo1.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(*),max(编号) from 帐单品种表"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
rs1.MoveFirst
If rs1.Fields(0) = 0 Then
t_max_number = 0
Else
t_max_number = rs1.Fields(1) + 1
End If
SQL = "INSERT INTO 帐单品种表(编号,帐本号,帐单号, 年份,品种)" & _
" VALUES ( " & t_max_number & "," & "'" & Text1.Text & "'" & "," & "'" & Text2.Text & "'" & "," & _
Text3.Text & "," & "'" & Combo1.Text & "'" & ")"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
.Execute
End With
Combo1.Text = ""
cnn1.Close
Set cnn1 = Nothing
MsgBox ("数据保存成功")
Combo1.SetFocus
exit_Command1_Click:
End Sub
Private Sub Form_Load()
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 品种 from 品种类型表 order by 品种"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
rs1.MoveFirst
i = 0
While Not rs1.EOF
Combo1.AddItem rs1.Fields(0), i
rs1.MoveNext
i = i + 1
Wend
Combo1.Text = ""
Text1.Text = g_book
Text2.Text = g_reckoning
Text3.Text = g_year
cnn1.Close
Set cnn1 = Nothing
End Sub
Private Sub Form_Unload(Cancel As Integer)
Select Case g_form
Case "form28"
Form28.Show
Case "form26"
g_form = "form26"
Form4.Show
End Select
End Sub
Private Sub Text1_GotFocus()
Combo1.SetFocus
End Sub
Private Sub Text2_GotFocus()
Combo1.SetFocus
End Sub
Private Sub Text3_GotFocus()
Combo1.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -