📄 form37.frm
字号:
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 1440
TabIndex = 9
Top = 3120
Width = 1200
End
Begin VB.Label Label5
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 = 1440
TabIndex = 7
Top = 2520
Width = 1200
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 = 1440
TabIndex = 5
Top = 1920
Width = 1200
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 = 1440
TabIndex = 3
Top = 1320
Width = 1200
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 = 1440
TabIndex = 1
Top = 720
Width = 1200
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 = 2040
TabIndex = 0
Top = 120
Width = 2520
End
End
Attribute VB_Name = "Form37"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim f_formshow
Private Sub Command1_Click()
Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command
Dim rs1 As ADODB.Recordset
If Text1.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Then
MsgBox ("输入不全")
Text1.SetFocus
GoSub exit_Command1_Click
End If
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 max(编号) from 购入帐单表"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
If rs1.EOF Then
t_max_row = 0
Else
rs1.MoveFirst
t_max_row = rs1.Fields(0) + 1
End If
SQL = "INSERT INTO 购入帐单表(编号,帐单号,年份,月份,日期,购入金额,未付金额,还款金额,备注," & _
"购入斤数) VALUES ( " & t_max_row & "," & "'" & Text1.Text & "'" & "," & Text2.Text & "," & _
Text3.Text & "," & Text4.Text & "," & Text5.Text & "," & Text6.Text & "," & _
Text7.Text & "," & "'" & Combo1.Text & "'" & "," & Text9.Text & ")"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
.Execute
End With
cnn1.Close
Set cnn1 = Nothing
g_reckoning = Text1.Text
Text1.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Combo1.Text = ""
MsgBox ("数据保存成功")
f_formshow = "NO"
g_form = "form37"
Form40.Show
Unload Form37
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
Text1.Text = ""
Text2.Text = g_year
Text3.Text = g_month
Text6.Text = 0
Combo1.Text = ""
Text9.Text = 0
f_formshow = "OK"
End Sub
Private Sub Form_Unload(Cancel As Integer)
If f_formshow = "OK" Then
Form2.Show
End If
End Sub
Private Sub Text1_LostFocus()
Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command
Dim rs1 As ADODB.Recordset
f_formshow = "OK"
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 & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
rs1.MoveFirst
If rs1.Fields(0) > 0 Then
MsgBox ("该帐单号已存在,请重输!")
cnn1.Close
Set cnn1 = Nothing
Text1.SetFocus
GoSub exit_text1_lostfocus
End If
SQL = "select count(*) from 品种购入表 where 单号 =" & "'" & Text1.Text & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
rs1.MoveFirst
If rs1.Fields(0) > 0 And Text1.Text <> "" Then
MsgBox ("该帐单号已存在,请重输!")
cnn1.Close
Set cnn1 = Nothing
Text1.SetFocus
GoSub exit_text1_lostfocus
End If
cnn1.Close
Set cnn1 = Nothing
exit_text1_lostfocus:
End Sub
Private Sub Text2_GotFocus()
Text4.SetFocus
End Sub
Private Sub Text3_GotFocus()
Text4.SetFocus
End Sub
Private Sub Text6_LostFocus()
If Text6.Text > Text5.Text Then
MsgBox ("期初未付金额不能大于购入金额!")
Text7.SetFocus
End If
End Sub
Private Sub Text7_GotFocus()
Combo1.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -