📄 form19.frm
字号:
VERSION 5.00
Begin VB.Form Form19
BorderStyle = 1 'Fixed Single
Caption = "Form19"
ClientHeight = 5355
ClientLeft = 45
ClientTop = 435
ClientWidth = 6495
LinkTopic = "Form19"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5355
ScaleWidth = 6495
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Height = 295
Left = 2985
TabIndex = 10
Text = "Text1"
Top = 960
Width = 1215
End
Begin VB.TextBox Text2
Height = 295
Left = 2985
TabIndex = 9
Text = "Text2"
Top = 1320
Width = 1215
End
Begin VB.TextBox Text3
Height = 270
Left = 2985
TabIndex = 8
Text = "Text3"
Top = 1680
Width = 1215
End
Begin VB.TextBox Text4
Height = 295
Left = 2985
TabIndex = 7
Top = 2040
Width = 1215
End
Begin VB.TextBox Text5
Height = 295
Left = 2985
TabIndex = 6
Top = 2400
Width = 1215
End
Begin VB.TextBox Text6
Height = 295
Left = 2985
TabIndex = 5
Text = "0"
Top = 2760
Width = 1215
End
Begin VB.TextBox Text7
Height = 295
Left = 2985
TabIndex = 4
Text = "0"
Top = 3120
Width = 1215
End
Begin VB.TextBox Text8
Height = 295
Left = 2985
TabIndex = 3
Text = "0"
Top = 3480
Width = 1215
End
Begin VB.TextBox Text9
Height = 295
Left = 2985
TabIndex = 2
Text = "0"
Top = 3840
Width = 1215
End
Begin VB.TextBox Text10
Height = 295
Left = 2985
TabIndex = 1
Text = "0"
Top = 4200
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "保存数据"
Height = 295
Left = 3000
TabIndex = 0
Top = 4680
Width = 1215
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "产品寄售输入画面"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1800
TabIndex = 21
Top = 360
Width = 2520
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "品种:"
Height = 180
Left = 2340
TabIndex = 20
Top = 960
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "年份:"
Height = 180
Left = 2340
TabIndex = 19
Top = 1320
Width = 540
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "月份:"
Height = 180
Left = 2340
TabIndex = 18
Top = 1680
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "日期:"
Height = 180
Left = 2340
TabIndex = 17
Top = 2040
Width = 540
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "单号:"
Height = 180
Left = 2340
TabIndex = 16
Top = 2400
Width = 540
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "购入斤数:"
Height = 180
Left = 1980
TabIndex = 15
Top = 2760
Width = 900
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "购入单价:"
Height = 180
Left = 1980
TabIndex = 14
Top = 3120
Width = 900
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "运 费:"
Height = 180
Left = 1980
TabIndex = 13
Top = 3840
Width = 900
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "购入金额:"
Height = 180
Left = 1980
TabIndex = 12
Top = 3480
Width = 900
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = " 卸车费:"
Height = 180
Left = 2070
TabIndex = 11
Top = 4200
Width = 810
End
End
Attribute VB_Name = "Form19"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim m_max_number
Private Sub Command1_Click()
Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command
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 = "INSERT INTO 品种寄售表(编号,品种, 年份,月份,日期,单号,购入斤数,购入单价," & _
"购入金额,运费,卸车费) VALUES ( " & m_max_number & "," & " '" & Text1.Text & "'" & "," & Text2.Text & "," & _
Text3.Text & "," & Text4.Text & ",'" & Text5.Text & "'" & "," & Text6.Text & "," & Text7.Text & _
"," & Text8.Text & "," & Text9.Text & "," & Text10.Text & ")"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
.Execute
End With
cnn1.Close
Set cnn1 = Nothing
Text4.Text = ""
Text5.Text = ""
Text6.Text = 0
Text7.Text = 0
Text8.Text = 0
Text9.Text = 0
Text10.Text = 0
MsgBox ("数据保存成功")
Text4.SetFocus
End Sub
Private Sub Form_Load()
Text1.Text = m_breed
Text2.Text = m_year
Text3.Text = m_month
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
m_max_number = 0
Else
m_max_number = rs1.Fields(1) + 1
End If
cnn1.Close
Set cnn1 = Nothing
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form2.Show
End Sub
Private Sub Text1_GotFocus()
Text4.SetFocus
End Sub
Private Sub Text2_GotFocus()
Text4.SetFocus
End Sub
Private Sub Text3_GotFocus()
Text4.SetFocus
End Sub
Private Sub Text8_GotFocus()
Text8.Text = Text6.Text * Text7.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -