📄 frmformquery.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmFormQuery
BorderStyle = 1 'Fixed Single
Caption = "单据查询"
ClientHeight = 8190
ClientLeft = 45
ClientTop = 330
ClientWidth = 13740
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 8190
ScaleWidth = 13740
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame1
Height = 7935
HelpContextID = 231
Left = 10800
TabIndex = 0
Top = 120
WhatsThisHelpID = 231
Width = 2775
Begin VB.CommandButton 打印
BackColor = &H80000000&
Caption = "打印"
Enabled = 0 'False
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
HelpContextID = 231
Left = 1560
Style = 1 'Graphical
TabIndex = 5
Top = 7080
Width = 975
End
Begin VB.ComboBox 单据名称
BackColor = &H80000004&
Height = 300
HelpContextID = 231
ItemData = "frmFormQuery.frx":0000
Left = 1080
List = "frmFormQuery.frx":0010
Style = 2 'Dropdown List
TabIndex = 4
Top = 300
Width = 1515
End
Begin VB.CommandButton 执行查询
BackColor = &H80000000&
Caption = "查询"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
HelpContextID = 231
Left = 360
Style = 1 'Graphical
TabIndex = 3
Top = 7080
Width = 915
End
Begin VB.ComboBox comboPerson
Height = 300
Left = 1080
TabIndex = 2
Top = 1800
Width = 1515
End
Begin VB.ComboBox comboArg
Height = 300
ItemData = "frmFormQuery.frx":0044
Left = 1080
List = "frmFormQuery.frx":0084
TabIndex = 1
Top = 2400
Width = 1515
End
Begin MSComCtl2.DTPicker 起始日期
Height = 300
Left = 1080
TabIndex = 6
Top = 780
Width = 1515
_ExtentX = 2672
_ExtentY = 529
_Version = 393216
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
CalendarBackColor= 8454143
CalendarForeColor= 8454143
CalendarTitleBackColor= 65535
Format = 20185089
UpDown = -1 'True
CurrentDate = 38373
End
Begin MSComCtl2.DTPicker 截止日期
Height = 300
Left = 1080
TabIndex = 13
Top = 1275
Width = 1515
_ExtentX = 2672
_ExtentY = 529
_Version = 393216
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
CalendarBackColor= 8454143
CalendarForeColor= 8454143
CalendarTitleBackColor= 65535
Format = 20185089
UpDown = -1 'True
CurrentDate = 38373
End
Begin VB.Label Label8
Caption = "截止日期"
Height = 255
Left = 120
TabIndex = 12
Top = 1320
Width = 735
End
Begin VB.Label Label2
Caption = "起始日期"
Height = 255
Left = 120
TabIndex = 11
Top = 840
Width = 735
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "单据名称:"
ForeColor = &H00000000&
Height = 195
Left = 120
TabIndex = 9
Top = 360
Width = 795
End
Begin VB.Label Label3
Caption = "经办人"
Height = 255
Left = 120
TabIndex = 8
Top = 1845
Width = 615
End
Begin VB.Label Label4
Caption = "相关产品或原料"
Height = 495
Left = 120
TabIndex = 7
Top = 2400
Width = 735
End
End
Begin MSDataGridLib.DataGrid DataGridForm
Height = 7935
Left = 120
TabIndex = 10
Top = 120
Width = 10575
_ExtentX = 18653
_ExtentY = 13996
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 14
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc AdodcForm
Height = 330
Left = 4560
Top = 3120
Visible = 0 'False
Width = 1455
_ExtentX = 2566
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "frmFormQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private SQL As String
Private Sub Form_Load()
起始日期.Year = Year(Date)
起始日期.Month = Month(Date)
起始日期.Day = Day(Date)
截止日期.Year = Year(Date)
截止日期.Month = Month(Date)
截止日期.Day = Day(Date)
'设置经办人下拉列表
cn.Open
Set rs.ActiveConnection = cn
rs.Open "用户密码表"
Do Until rs.EOF
comboPerson.AddItem rs!姓名
rs.MoveNext
Loop
rs.Close
cn.Close
End Sub
Private Sub 打印_Click()
On Error Resume Next
If DataEnvironmentForm.rscmdProductIn.State <> adStateClosed Then
DataEnvironmentForm.rscmdProductIn.Close
End If
If DataEnvironmentForm.rscmdProductOut.State <> adStateClosed Then
DataEnvironmentForm.rscmdProductOut.Close
End If
If DataEnvironmentForm.rscmdMeteralIn.State <> adStateClosed Then
DataEnvironmentForm.rscmdMeteralIn.Close
End If
If DataEnvironmentForm.rscmdMeteralOut.State <> adStateClosed Then
DataEnvironmentForm.rscmdMeteralOut.Close
End If
DataEnvironmentForm.Connection1.Open "C:\windows\system\basema.mdb"
If 单据名称.Text = "产品入库表" Then
DataEnvironmentForm.rscmdProductIn.Open SQL
Set DataReport1.DataSource = DataEnvironmentForm
DataReport1.DataMember = "CmdProductIn"
DataReport1.Show
ElseIf 单据名称.Text = "产品出库表" Then
DataEnvironmentForm.rscmdProductOut.Open SQL
Set DataReport2.DataSource = DataEnvironmentForm
DataReport2.DataMember = "CmdProductOut"
DataReport2.Show
ElseIf 单据名称.Text = "原料入库表" Then
DataEnvironmentForm.rscmdMeteralIn.Open SQL
Set DataReport3.DataSource = DataEnvironmentForm
DataReport3.DataMember = "cmdMeteralIn"
DataReport3.Show
ElseIf 单据名称.Text = "原料出库表" Then
DataEnvironmentForm.rscmdMeteralOut.Open SQL
Set DataReport4.DataSource = DataEnvironmentForm
DataReport4.DataMember = "cmdMeteralOut"
DataReport4.Show
End If
End Sub
Private Sub 执行查询_Click()
Dim ProductOrMeteralName As String
AdodcForm.ConnectionString = connectString
If 单据名称.Text = "" Then MsgBox "请选择单据名称!": Exit Sub
Dim startT As String
Dim endT As String
SQL = ""
On Error GoTo quit
startT = Str(起始日期.Year) + "-" + Str(起始日期.Month) + "-" + Str(起始日期.Day)
endT = Str(截止日期.Year) + "-" + Str(截止日期.Month) + "-" + Str(截止日期.Day)
If 单据名称.Text = "产品入库表" Then
SQL = "select 产品类型,来源,存放位置,班次,工号,件数,数量,经办人,产品说明,备注信息,日期 from 产品入库记录表 where 日期 = 日期"
ProductOrMeteralName = "产品类型"
ElseIf 单据名称.Text = "产品出库表" Then
SQL = "select 产品类型,原存放位置,件数,数量,经办人,产品说明,用车信息,备注信息,日期 from 产品出库记录表 where 日期 = 日期"
ProductOrMeteralName = "产品类型"
ElseIf 单据名称.Text = "原料入库表" Then
SQL = "select 原料名称,数量,供应商,品牌,经办人,原料说明,日期 from 原料入库记录表 where 日期 = 日期"
ProductOrMeteralName = "原料名称"
ElseIf 单据名称.Text = "原料出库表" Then
SQL = "select 原料名称,数量,供应商,品牌,经办人,原料说明,日期 from 原料出库记录表 where 日期 = 日期"
ProductOrMeteralName = "原料名称"
End If
If SQL <> "" Then
SQL = SQL + " and " + "日期 >= " + "#" + startT + "#" & " and 日期 <= " + "#" + endT + "#"
If comboPerson.Text <> "" Then
SQL = SQL + " and 经办人 = '" & comboPerson.Text & "'"
End If
If comboArg.Text <> "" Then
SQL = SQL + " and " & ProductOrMeteralName & " = '" & comboArg.Text & "'"
End If
AdodcForm.RecordSource = SQL
Set DataGridForm.DataSource = AdodcForm
AdodcForm.Refresh
End If
打印.Enabled = True
quit:
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -