📄 addkaiform1.frm
字号:
VERSION 5.00
Begin VB.Form addkaiform1
Caption = "新建开票单"
ClientHeight = 3975
ClientLeft = 60
ClientTop = 345
ClientWidth = 6765
Icon = "addkaiform1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3975
ScaleWidth = 6765
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox Combo3
Height = 300
Left = 1080
TabIndex = 23
Top = 1080
Visible = 0 'False
Width = 2295
End
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 375
Left = 3720
TabIndex = 21
Top = 3480
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "确 定"
Height = 375
Left = 1560
TabIndex = 20
Top = 3480
Width = 1455
End
Begin VB.TextBox Text8
Height = 855
Left = 1080
ScrollBars = 3 'Both
TabIndex = 19
Top = 2400
Width = 5415
End
Begin VB.TextBox Text7
Height = 375
Left = 1080
TabIndex = 17
Top = 1965
Width = 2295
End
Begin VB.TextBox Text6
Enabled = 0 'False
Height = 375
Left = 4200
TabIndex = 15
Top = 1485
Width = 1695
End
Begin VB.ComboBox Combo2
Enabled = 0 'False
Height = 300
Left = 4200
TabIndex = 13
Top = 1080
Width = 2295
End
Begin VB.TextBox Text5
Enabled = 0 'False
Height = 375
Left = 4200
TabIndex = 11
Top = 600
Width = 2295
End
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 375
Left = 4200
TabIndex = 9
Top = 120
Width = 2295
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1080
TabIndex = 7
Top = 1080
Width = 2295
End
Begin VB.TextBox Text4
Enabled = 0 'False
Height = 375
Left = 1080
TabIndex = 6
Top = 1485
Width = 2295
End
Begin VB.TextBox Text2
Height = 375
Left = 1080
TabIndex = 3
Top = 600
Width = 2295
End
Begin VB.TextBox Text1
Height = 375
Left = 1080
TabIndex = 1
Top = 120
Width = 2295
End
Begin VB.Label Label11
Caption = "(元)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 6000
TabIndex = 22
Top = 1590
Width = 735
End
Begin VB.Label Label10
Caption = "备注:"
Height = 255
Left = 480
TabIndex = 18
Top = 2520
Width = 615
End
Begin VB.Label Label9
Caption = "数量:"
Height = 255
Left = 480
TabIndex = 16
Top = 2040
Width = 615
End
Begin VB.Label Label8
Caption = "单价:"
Height = 375
Left = 3600
TabIndex = 14
Top = 1560
Width = 615
End
Begin VB.Label Label7
Caption = "单位:"
Height = 255
Left = 3600
TabIndex = 12
Top = 1140
Width = 615
End
Begin VB.Label Label6
Caption = "品名:"
Height = 255
Left = 3600
TabIndex = 10
Top = 705
Width = 615
End
Begin VB.Label Label5
Caption = "类别:"
Height = 375
Left = 3600
TabIndex = 8
Top = 240
Width = 615
End
Begin VB.Label Label4
Caption = "仓库:"
Height = 255
Left = 480
TabIndex = 5
Top = 1560
Width = 735
End
Begin VB.Label Label3
Caption = "物品代号:"
Height = 375
Left = 120
TabIndex = 4
Top = 1140
Width = 975
End
Begin VB.Label Label2
Caption = "购货单位:"
Height = 255
Left = 120
TabIndex = 2
Top = 705
Width = 1095
End
Begin VB.Label Label1
Caption = "凭证号:"
Height = 255
Left = 285
TabIndex = 0
Top = 240
Width = 855
End
End
Attribute VB_Name = "addkaiform1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private rs As New ADODB.Recordset
Private strconn As String
Private strsql As String
Private rs1 As New ADODB.Recordset
Private strsql1 As String
Private rs41 As New ADODB.Recordset
Private strsql41 As String
Private rs11 As New ADODB.Recordset
Private strsql11 As String
Private strsq2 As String
Private rs2 As New ADODB.Recordset
Private strsq3 As String
Private rs333 As New ADODB.Recordset
Private max1 As String
Private max2 As String
Private i As Integer
Private itt As String 'combo1,combo3变量
Private Sub Combo1_Click()
On Error Resume Next
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\jxc.mdb"
strsql1 = "select 仓库,类别,品名,单位,单价(元) from base where 代号='" & Combo1.Text & "'"
With rs1
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = strsql1
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
Text4.Text = rs1(0)
Text3.Text = rs1(1)
Text5.Text = rs1(2)
Combo2.Text = rs1(3)
Text6.Text = rs1(4)
itt = Combo1.Text
End Sub
Private Sub Combo3_Click()
'Text4.Enabled = True
'Text3.Enabled = True
'Text5.Enabled = True
'Combo2.Enabled = True
'Text6.Enabled = True
On Error Resume Next
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\jxc.mdb"
strsql11 = "select 仓库,类别,品名,单位,单价(元) from base where 代号='" & Combo3.Text & "'"
With rs11
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = strsql11
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
Text1.Text = kaiform1.Combo1.Text
Text1.Enabled = False
Text2.Text = kaiform1.Text1.Text
Text4.Text = rs11(0)
Text3.Text = rs11(1)
Text5.Text = rs11(2)
Combo2.Text = rs11(3)
Text6.Text = rs11(4)
itt = Combo3.Text
Combo1.Text = Combo3.Text
xu1 = 1
End Sub
Private Sub Command1_Click()
On Error Resume Next
re = 1
ck = Text4.Text
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\jxc.mdb"
strsq3 = "select 数量 from base where 代号='" & itt & "'"
With rs333
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = strsq3
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
If rs333(0) < Int(Text7.Text) Then
MsgBox "数量不能大于库存量" & rs333(0) & Combo2.Text & ",或数量栏不能填写字母或文字"
Exit Sub
End If
Set rs333 = Nothing
kaiform1.Command5.Enabled = False
kaiform1.Command6.Enabled = False
ok1 = 1
kaiform1.Text3.Text = user1
Call xulang1
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error Resume Next
xu1 = 0
MDIForm1.Enabled = False
kaiform1.Enabled = False
If kaiform1.Command1.Caption = "新 建" Then
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\jxc.mdb"
strsql = "select 代号 from base"
With rs
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = strsql
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
rs.MoveFirst
Do While Not rs.EOF
Combo1.AddItem (rs(0))
rs.MoveNext
Loop
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\jxc.mdb"
strsq2 = "select max(凭证号) from kai1"
With rs2
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = strsq2
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
max1 = rs2(0) + 1
max2 = "0"
For i = 1 To 5 - Len(max1)
max2 = max2 & "0"
Next i
Text1.Text = max2 & max1
Text1.Enabled = False
Else
Combo1.Visible = False
Combo3.Visible = True
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\jxc.mdb"
strsql41 = "select 代号 from base where 仓库='" & ck & "'"
With rs41
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = strsql41
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
rs41.MoveFirst
Do While Not rs41.EOF
addkaiform1.Combo3.AddItem rs41(0)
rs41.MoveNext
Loop
Text1.Text = kaiform1.Combo1.Text
Text1.Enabled = False
Text2.Text = kaiform1.Text1.Text
End If
End Sub
Private Sub Form_Resize()
addkaiform1.Width = 6885
addkaiform1.Height = 4380
End Sub
Private Sub Form_Unload(Cancel As Integer)
MDIForm1.Enabled = True
kaiform1.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -