📄 frminput.frm
字号:
Left = 1260
Sorted = -1 'True
TabIndex = 22
Top = 810
Width = 1845
End
Begin VB.Label Label3
Caption = "添加商品"
Height = 285
Left = 270
TabIndex = 44
Top = 240
Width = 1125
End
Begin VB.Label lblPID
AutoSize = -1 'True
Caption = "商品编号:"
Height = 180
Left = 270
TabIndex = 27
Top = 540
Width = 810
End
Begin VB.Label lblPName
AutoSize = -1 'True
Caption = "商品名称:"
Height = 180
Left = 3450
TabIndex = 26
Top = 540
Width = 810
End
Begin VB.Label lblPModel
AutoSize = -1 'True
Caption = "型号:"
Height = 180
Left = 3810
TabIndex = 25
Top = 855
Width = 450
End
Begin VB.Label Label2
Caption = "生产厂商:"
Height = 255
Left = 270
TabIndex = 24
Top = 870
Width = 885
End
End
Begin VB.Frame fraAddFactory
Height = 2085
Left = 30
TabIndex = 28
Top = 3810
Width = 6555
Begin VB.TextBox txtFID
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 1230
Locked = -1 'True
TabIndex = 11
TabStop = 0 'False
Top = 570
Width = 1875
End
Begin VB.TextBox txtFName
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 4440
TabIndex = 12
Top = 570
Width = 1875
End
Begin VB.TextBox txtFManager
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 1230
TabIndex = 13
Top = 870
Width = 1875
End
Begin VB.TextBox txtFPhone
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 4440
TabIndex = 14
Top = 870
Width = 1875
End
Begin VB.TextBox txtFAddr
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 1230
TabIndex = 17
Top = 1170
Width = 5085
End
Begin VB.CommandButton cmdAddFactory
Caption = "添加到数据库(F)"
Enabled = 0 'False
Height = 315
Left = 3360
TabIndex = 18
Top = 1590
Width = 1695
End
Begin VB.CommandButton cmdAddFactoryCancel
Caption = "取消(N)"
Height = 315
Left = 5070
TabIndex = 19
Top = 1590
Width = 1245
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "添加厂商"
Height = 180
Left = 270
TabIndex = 45
Top = 270
Width = 720
End
Begin VB.Label lblFID
AutoSize = -1 'True
Caption = "厂商编号:"
Height = 180
Left = 270
TabIndex = 33
Top = 600
Width = 810
End
Begin VB.Label lblFName
AutoSize = -1 'True
Caption = "厂商名称:"
Height = 180
Left = 3480
TabIndex = 32
Top = 600
Width = 810
End
Begin VB.Label lblFManager
AutoSize = -1 'True
Caption = "法人代表:"
Height = 180
Left = 270
TabIndex = 31
Top = 915
Width = 810
End
Begin VB.Label lblFAddr
AutoSize = -1 'True
Caption = "厂商地址:"
Height = 180
Left = 270
TabIndex = 30
Top = 1215
Width = 810
End
Begin VB.Label lblFPhone
AutoSize = -1 'True
Caption = "厂商电话:"
Height = 180
Left = 3480
TabIndex = 29
Top = 930
Width = 810
End
End
End
Attribute VB_Name = "frmInput"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public i As Integer
Public LastTable As String
Public InComboBox As Boolean
Public CanAddFactory As Boolean
Public CanAddProduct As Boolean
Private Sub SetInputID()
Set rdoRS = rdoConn.OpenResultset("select count(i_id) c from input")
RowsInTable = rdoRS.rdoColumns("c")
IID = "I" & Format(RowsInTable + 1, "000000000")
txtInputID.Text = IID
rdoRS.Close
End Sub
Public Sub InitAddLog()
txtInputID.Text = ""
txtCount.Text = ""
txtPrice.Text = ""
cobFactory.Text = ""
FillCobProduct (True)
txtYear.Text = Year(Now)
txtMonth.Text = Month(Now)
txtday.Text = Day(Now)
End Sub
Public Sub InitAddFactory()
txtFID.Text = ""
txtFName.Text = ""
txtFManager.Text = ""
txtFAddr.Text = ""
txtFPhone.Text = ""
End Sub
Public Sub InitAddProduct()
txtPID.Text = ""
txtPName.Text = ""
cobPFactory.Text = ""
txtPModel.Text = ""
End Sub
Public Sub FillCobProduct(Constraint As Boolean) 'Constraint表示商品是否受到厂商的约束
Dim found As Boolean
FID = "NULL"
If Constraint Then
Set rdoRS = rdoConn.OpenResultset("select f_id,f_name from factory")
found = False
While Not found And Not rdoRS.EOF
If rdoRS.rdoColumns("f_name") = cobFactory.Text Then
found = True
FID = rdoRS.rdoColumns("f_id")
Else
rdoRS.MoveNext
End If
Wend
rdoRS.Close
End If
cobProduct.Clear
cobProduct.AddItem "<new>"
If Constraint Then
Set rdoRS = rdoConn.OpenResultset("select p_name,p_model from product where f_id='" & FID & "'")
Else
Set rdoRS = rdoConn.OpenResultset("select p_name,p_model from product")
End If
InComboBox = False
i = 1
While Not rdoRS.EOF '将商品名称加入cobProduct列表框,并防止重复
While (i <= cobProduct.ListCount) And (InComboBox = False)
If LCase(rdoRS.rdoColumns("p_name")) & " " & rdoRS.rdoColumns("p_model") = LCase(cobProduct.List(i - 1)) Then
InComboBox = True
Else
i = i + 1
End If
Wend
If Not InComboBox Then
cobProduct.AddItem rdoRS.rdoColumns("p_name") & " " & rdoRS.rdoColumns("p_model")
End If
rdoRS.MoveNext
InComboBox = False
Wend
rdoRS.Close
End Sub
Public Sub FillCobFactory()
cobFactory.Clear
cobFactory.AddItem "<new>"
Set rdoRS = rdoConn.OpenResultset("select f_name from factory", rdOpenKeyset)
While Not rdoRS.EOF '将厂商名称加入cobFactory列表框
cobFactory.AddItem rdoRS.rdoColumns(0).Value
rdoRS.MoveNext
Wend
rdoRS.Close
End Sub
Public Sub FillCobPFactory()
cobPFactory.Clear
cobPFactory.AddItem "<new>"
Set rdoRS = rdoConn.OpenResultset("select f_name from factory", rdOpenKeyset)
While Not rdoRS.EOF '将厂商名称加入cobFactory列表框
cobPFactory.AddItem rdoRS.rdoColumns(0).Value
rdoRS.MoveNext
Wend
rdoRS.Close
End Sub
Public Sub IfCanAddFactory()
CanAddFactory = (txtFID.Text <> "") And (txtFName.Text <> "")
If CanAddFactory Then
cmdAddFactory.Enabled = True
Else
cmdAddFactory.Enabled = False
End If
End Sub
Public Sub IfCanAddProduct()
CanAddProduct = (txtPID.Text <> "") And (txtPName.Text <> "") _
And (cobPFactory.Text <> "")
If CanAddProduct Then
cmdAddProduct.Enabled = True
Else
cmdAddProduct.Enabled = False
End If
End Sub
Private Sub IfCanAddLog()
Dim CanAddLog As Boolean
CanAddLog = (cobProduct.Text <> "") And (cobFactory.Text <> "") _
And (txtPrice <> "") And (txtCount.Text <> "") _
And (txtYear.Text <> "") And (txtMonth.Text <> "") _
And (txtday.Text <> "") And (txtInputID.Text <> "")
If CanAddLog Then
cmdAddLog.Enabled = True
Else
cmdAddLog.Enabled = False
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -