📄 进货查询.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmJHCX
'Download by http://www.codefans.net
Caption = "商品入库查询"
ClientHeight = 7245
ClientLeft = 60
ClientTop = 345
ClientWidth = 11835
Icon = "进货查询.frx":0000
LinkTopic = "Form1"
MDIChild = -1 'True
Picture = "进货查询.frx":0442
ScaleHeight = 7245
ScaleWidth = 11835
WindowState = 2 'Maximized
Begin VB.CommandButton cmdExit
Cancel = -1 'True
Caption = "退 出"
Height = 375
Left = 7200
TabIndex = 9
Top = 1080
Width = 1095
End
Begin VB.CommandButton cmdOK
Caption = "开始查找"
Height = 375
Left = 7200
TabIndex = 8
Top = 600
Width = 1095
End
Begin MSComCtl2.DTPicker DTEnd
Height = 300
Left = 4680
TabIndex = 4
Top = 1200
Width = 1575
_ExtentX = 2778
_ExtentY = 529
_Version = 393216
CalendarBackColor= 16761024
CalendarTitleBackColor= 12648447
Format = 78446593
CurrentDate = 38034
End
Begin MSComCtl2.DTPicker DTStar
Height = 300
Left = 1320
TabIndex = 3
Top = 1200
Width = 1575
_ExtentX = 2778
_ExtentY = 529
_Version = 393216
CalendarBackColor= 16761024
CalendarTitleBackColor= 12648447
Format = 78446593
CurrentDate = 38034
End
Begin VB.ComboBox cboName
Height = 300
Left = 1320
TabIndex = 2
Text = "请选择"
Top = 600
Width = 1575
End
Begin MSFlexGridLib.MSFlexGrid flggrid
Height = 5775
Left = 0
TabIndex = 0
Top = 1560
Width = 11895
_ExtentX = 20981
_ExtentY = 10186
_Version = 393216
BackColorFixed = 14085351
BackColorBkg = 14939377
AllowUserResizing= 3
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "结束日期:"
Height = 180
Index = 3
Left = 3600
TabIndex = 7
Top = 1200
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "开始日期:"
Height = 180
Index = 2
Left = 360
TabIndex = 6
Top = 1200
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "商品名称:"
Height = 180
Index = 0
Left = 360
TabIndex = 5
Top = 600
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "商品进货查询"
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 700
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 360
Left = 4815
TabIndex = 1
Top = 0
Width = 2250
End
End
Attribute VB_Name = "frmJHCX"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Db As Database
Dim RS As Recordset
Dim sql As String
Public Sub Search()
'初始化MSFlexGrid
flggrid.Clear '清空
flggrid.Cols = 5 '设置总列数
flggrid.FixedCols = 0 '固定列为0
flggrid.FixedRows = 1 '固定行为1
'设置每一列的宽度
flggrid.ColWidth(0) = flggrid.Width / 6
flggrid.ColWidth(1) = flggrid.Width / 5
flggrid.ColWidth(2) = flggrid.Width / 5
flggrid.ColWidth(3) = flggrid.Width / 5
flggrid.ColWidth(4) = flggrid.Width / 5
'设置列标题
flggrid.TextMatrix(0, 0) = "商品编号"
flggrid.TextMatrix(0, 1) = "商品名称"
flggrid.TextMatrix(0, 2) = "商品价格"
flggrid.TextMatrix(0, 3) = "进货数量"
flggrid.TextMatrix(0, 4) = "进货日期"
flggrid.Rows = 2
If RS.EOF = True Then
MsgBox "没有符合条件的记录"
Else
RS.MoveFirst ' 移动到记录集的第一条记录
' 使用循环将记录集中的记录写入表中,循环的退出条件是rs.eof
Do While Not RS.EOF ' Loops until the Recordset is at end. (EOF = End Of File)
flggrid.TextMatrix(flggrid.Rows - 1, 0) = RS.Fields("code").Value ' Set Grid Col 0 the data from Row 0
flggrid.TextMatrix(flggrid.Rows - 1, 1) = RS.Fields("name").Value ' Set Grid Col 1 the data from Row 1
flggrid.TextMatrix(flggrid.Rows - 1, 2) = RS.Fields("rate").Value ' Set Grid Col 2 the data from Row 2
flggrid.TextMatrix(flggrid.Rows - 1, 3) = RS.Fields("number").Value ' Set Grid Col 3 the data from Row 3
flggrid.TextMatrix(flggrid.Rows - 1, 4) = RS.Fields("date").Value
flggrid.Rows = flggrid.Rows + 1 '给表加一行
RS.MoveNext ' 下一条记录
Loop
End If
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
sql = "select * from 进货单 where name='" & cboName.Text & "' AND date Between #" & DTStar.Value & "# And #" & DTEnd.Value & "#"
Set RS = Db.OpenRecordset(sql)
Search
End Sub
Private Sub Form_Load()
Set Db = OpenDatabase(App.Path + "\db1.mdb")
Set RS = Db.OpenRecordset("进货单")
Do While Not RS.EOF
cboName.AddItem RS.Fields("name")
RS.MoveNext
Loop
DTStar.Value = Date
DTEnd.Value = Date
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -