📄 searchkc.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form SearchKC
AutoRedraw = -1 'True
BorderStyle = 3 'Fixed Dialog
Caption = "库存信息"
ClientHeight = 4770
ClientLeft = 45
ClientTop = 330
ClientWidth = 7170
Icon = "SearchKC.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4770
ScaleWidth = 7170
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.PictureBox Report1
Height = 480
Left = 270
ScaleHeight = 420
ScaleWidth = 1140
TabIndex = 9
Top = 4785
Width = 1200
End
Begin VB.CommandButton ViewAll
BackColor = &H00C0E0FF&
Caption = "所有(&A)"
Enabled = 0 'False
Height = 420
Left = 3825
Style = 1 'Graphical
TabIndex = 3
Top = 120
Width = 825
End
Begin MSFlexGridLib.MSFlexGrid Grid2
Height = 3900
Left = 75
TabIndex = 7
Top = 750
Width = 6990
_ExtentX = 12330
_ExtentY = 6879
_Version = 393216
Rows = 10
Cols = 6
BackColorSel = 12648384
ForeColorSel = 8388608
BackColorBkg = 12632256
AllowBigSelection= 0 'False
FocusRect = 0
ScrollBars = 2
SelectionMode = 1
End
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
BackColor = &H00808000&
Height = 555
Left = 90
ScaleHeight = 495
ScaleWidth = 6900
TabIndex = 6
Top = 60
Width = 6960
Begin VB.CheckBox Check1
BackColor = &H00808000&
Caption = "模糊"
ForeColor = &H0000FF00&
Height = 360
Left = 2265
TabIndex = 1
Top = 75
Width = 510
End
Begin VB.TextBox Text1
Height = 300
Left = 930
MaxLength = 20
TabIndex = 0
Top = 90
Width = 1245
End
Begin VB.CommandButton SearchB
BackColor = &H00C0E0FF&
Caption = "查找(&F)"
Enabled = 0 'False
Height = 420
Left = 2850
Style = 1 'Graphical
TabIndex = 2
Top = 30
Width = 825
End
Begin VB.CommandButton ExitButton
Cancel = -1 'True
Caption = "关闭(&C)"
Height = 420
Left = 5730
TabIndex = 5
Top = 30
Width = 1140
End
Begin VB.CommandButton PrintCK
Caption = "打印(&P)"
Height = 420
Left = 4590
TabIndex = 4
Top = 30
Width = 1140
End
Begin VB.Line Line2
BorderColor = &H00FFFFFF&
X1 = 4545
X2 = 4545
Y1 = 0
Y2 = 495
End
Begin VB.Line Line1
X1 = 4530
X2 = 4530
Y1 = 0
Y2 = 480
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "产品名称:"
ForeColor = &H0000FFFF&
Height = 180
Left = 75
TabIndex = 8
Top = 150
Width = 900
End
End
End
Attribute VB_Name = "SearchKC"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub ExitButton_Click()
Unload Me
End Sub
Private Sub Form_Load()
SearchKC.Caption = "《" + CkTypeName + "》" + SearchKC.Caption
Dim DB As Database, Ef As Recordset, HH As Integer, TempStr As String
Set DB = OpenDatabase(App.Path & "\Sys\Store.mdb", 0, 0, Constr)
TempStr = "Delete * From KcKPrint"
DB.Execute TempStr
TempStr = "Insert into KcKPrint Select * From KcK Where 仓库类型='" & CkTypeName & "'"
DB.Execute TempStr
'配置网格
Grid2.Visible = False
Grid2.Cols = 5
Grid2.FormatString = "^ 序号 |^ 产品类型 |^ 产品名称 |^ 单位 |^ 数量 "
Grid2.ColWidth(0) = 830
Grid2.ColWidth(1) = 1800
Grid2.ColWidth(2) = 2000
Grid2.ColWidth(3) = 800
Grid2.ColWidth(4) = 1200
Set Ef = DB.OpenRecordset("KcK", dbOpenTable)
Grid2.Rows = Ef.RecordCount + 15
Set Ef = DB.OpenRecordset("Select 产品类型,产品名称,单位,数量 From KCK Where 仓库类型='" & CkTypeName & "'", dbOpenDynaset)
HH = 1
Do While Not Ef.EOF()
Grid2.Row = HH
Grid2.Col = 1
Grid2.CellAlignment = 1
If Not IsNull(Ef.Fields(0).Value) Then
Grid2.Text = Ef.Fields(0).Value
End If
Grid2.Row = HH
Grid2.Col = 2
Grid2.CellAlignment = 1
If Not IsNull(Ef.Fields(1).Value) Then
Grid2.Text = Ef.Fields(1).Value
End If
Grid2.Row = HH
Grid2.Col = 3
Grid2.CellAlignment = 1
If Not IsNull(Ef.Fields(2).Value) Then
Grid2.Text = Ef.Fields(2).Value
End If
Grid2.Row = HH
Grid2.Col = 4
Grid2.CellAlignment = 1
If Not IsNull(Ef.Fields(3).Value) Then
Grid2.Text = Ef.Fields(3).Value
End If
Ef.MoveNext
HH = HH + 1
Loop
DB.Close
For HH = 1 To Grid2.Rows - 1
Grid2.Row = HH
Grid2.Col = 0
Grid2.Text = HH
If Len(Grid2.Text) = 1 Then
Grid2.Text = "0" + Grid2.Text
End If
Next
Grid2.Col = 1
Grid2.Row = 1
Grid2.ColSel = 4
Grid2.Visible = True
End Sub
Private Sub PrintCK_Click()
SearchKC.MousePointer = 11
Report1.ReportFileName = Browser + "report\KcKPrint.rpt"
Report1.DataFiles(0) = ConData2
Report1.DataFiles(1) = ConData3
On Error Resume Next
Report1.WindowState = crptNormal
Report1.PrintReport
SearchKC.MousePointer = 0
End Sub
Private Sub SearchB_Click()
ViewAll.Enabled = True
SearchKC.MousePointer = 11
Dim DB As Database, Ef As Recordset, HH As Integer, TempStr As String
Set DB = OpenDatabase(App.Path & "\Sys\Store.mdb", 0, 0, Constr)
TempStr = "Delete * From KcKPrint"
DB.Execute TempStr
'配置网格
Grid2.Visible = False
Grid2.Cols = 5
Grid2.Clear
Grid2.FormatString = "^ 序号 |^ 产品类型 |^ 产品名称 |^ 单位 |^ 数量 "
Grid2.ColWidth(0) = 830
Grid2.ColWidth(1) = 1800
Grid2.ColWidth(2) = 2000
Grid2.ColWidth(3) = 800
Grid2.ColWidth(4) = 1200
Set Ef = DB.OpenRecordset("KcK", dbOpenTable)
Grid2.Rows = Ef.RecordCount + 15
If Check1.Value = 0 Then
Set Ef = DB.OpenRecordset("Select 产品类型,产品名称,单位,数量 From KCK Where 仓库类型='" & CkTypeName & "' and 产品名称='" & Trim(Text1.Text) & "'", dbOpenDynaset)
TempStr = "Insert into KcKPrint Select * From KcK Where 仓库类型='" & CkTypeName & "' and 产品名称='" & Trim(Text1.Text) & "'"
DB.Execute TempStr
Else
Set Ef = DB.OpenRecordset("Select 产品类型,产品名称,单位,数量 From KCK Where 仓库类型='" & CkTypeName & "' and 产品名称 Like '*" & Trim(Text1.Text) & "*'", dbOpenDynaset)
TempStr = "Insert into KcKPrint Select * From KcK Where 仓库类型='" & CkTypeName & "' and 产品名称 Like '*" & Trim(Text1.Text) & "*'"
DB.Execute TempStr
End If
HH = 1
Do While Not Ef.EOF()
Grid2.Row = HH
Grid2.Col = 1
Grid2.CellAlignment = 1
If Not IsNull(Ef.Fields(0).Value) Then
Grid2.Text = Ef.Fields(0).Value
End If
Grid2.Row = HH
Grid2.Col = 2
Grid2.CellAlignment = 1
If Not IsNull(Ef.Fields(1).Value) Then
Grid2.Text = Ef.Fields(1).Value
End If
Grid2.Row = HH
Grid2.Col = 3
Grid2.CellAlignment = 1
If Not IsNull(Ef.Fields(2).Value) Then
Grid2.Text = Ef.Fields(2).Value
End If
Grid2.Row = HH
Grid2.Col = 4
Grid2.CellAlignment = 1
If Not IsNull(Ef.Fields(3).Value) Then
Grid2.Text = Ef.Fields(3).Value
End If
Ef.MoveNext
HH = HH + 1
Loop
DB.Close
For HH = 1 To Grid2.Rows - 1
Grid2.Row = HH
Grid2.Col = 0
Grid2.Text = HH
If Len(Grid2.Text) = 1 Then
Grid2.Text = "0" + Grid2.Text
End If
Next
Grid2.Col = 1
Grid2.Row = 1
Grid2.ColSel = 4
Grid2.Visible = True
SearchKC.MousePointer = 0
Text1.SetFocus
End Sub
Private Sub Text1_Change()
If Trim(Text1.Text) <> "" Then
SearchB.Enabled = True
Else
SearchB.Enabled = False
End If
End Sub
Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Trim(Text1.Text) <> "" Then
SearchB.SetFocus
End If
End Sub
Private Sub ViewAll_Click()
SearchKC.MousePointer = 11
Dim DB As Database, Ef As Recordset, HH As Integer, TempStr As String
Set DB = OpenDatabase(App.Path & "\Sys\Store.mdb", 0, 0, Constr)
TempStr = "Delete * From KcKPrint"
DB.Execute TempStr
TempStr = "Insert into KcKPrint Select * From KcK Where 仓库类型='" & CkTypeName & "'"
DB.Execute TempStr
'配置网格
Grid2.Visible = False
Grid2.Cols = 5
Grid2.Clear
Grid2.FormatString = "^ 序号 |^ 产品类型 |^ 产品名称 |^ 单位 |^ 数量 "
Grid2.ColWidth(0) = 830
Grid2.ColWidth(1) = 1800
Grid2.ColWidth(2) = 2000
Grid2.ColWidth(3) = 800
Grid2.ColWidth(4) = 1200
Set Ef = DB.OpenRecordset("KcK", dbOpenTable)
Grid2.Rows = Ef.RecordCount + 15
Set Ef = DB.OpenRecordset("Select 产品类型,产品名称,单位,数量 From KCK Where 仓库类型='" & CkTypeName & "'", dbOpenDynaset)
HH = 1
Do While Not Ef.EOF()
Grid2.Row = HH
Grid2.Col = 1
Grid2.CellAlignment = 1
If Not IsNull(Ef.Fields(0).Value) Then
Grid2.Text = Ef.Fields(0).Value
End If
Grid2.Row = HH
Grid2.Col = 2
Grid2.CellAlignment = 1
If Not IsNull(Ef.Fields(1).Value) Then
Grid2.Text = Ef.Fields(1).Value
End If
Grid2.Row = HH
Grid2.Col = 3
Grid2.CellAlignment = 1
If Not IsNull(Ef.Fields(2).Value) Then
Grid2.Text = Ef.Fields(2).Value
End If
Grid2.Row = HH
Grid2.Col = 4
Grid2.CellAlignment = 1
If Not IsNull(Ef.Fields(3).Value) Then
Grid2.Text = Ef.Fields(3).Value
End If
Ef.MoveNext
HH = HH + 1
Loop
DB.Close
For HH = 1 To Grid2.Rows - 1
Grid2.Row = HH
Grid2.Col = 0
Grid2.Text = HH
If Len(Grid2.Text) = 1 Then
Grid2.Text = "0" + Grid2.Text
End If
Next
Grid2.Col = 1
Grid2.Row = 1
Grid2.ColSel = 4
Grid2.Visible = True
SearchKC.MousePointer = 0
Text1.Text = ""
Text1.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -