?? frmgetoutprint.frm
字號:
VERSION 5.00
Begin VB.Form FrmGetOutPrint
BorderStyle = 3 'Fixed Dialog
Caption = "出庫信息報表打印條件設置"
ClientHeight = 3435
ClientLeft = 45
ClientTop = 435
ClientWidth = 4395
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3435
ScaleWidth = 4395
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Caption = "出庫信息查詢條件"
Height = 3015
Left = 120
TabIndex = 0
Top = 240
Width = 4095
Begin VB.CommandButton Command1
Caption = "打印預覽"
Height = 375
Left = 1440
TabIndex = 9
Top = 2400
Width = 1095
End
Begin VB.ComboBox CB_EndDay
Height = 300
Left = 3000
TabIndex = 8
Top = 1800
Width = 615
End
Begin VB.ComboBox CB_EndMonth
Height = 300
Left = 2040
TabIndex = 7
Top = 1800
Width = 615
End
Begin VB.ComboBox CB_EndYear
Height = 300
Left = 1080
TabIndex = 6
Top = 1800
Width = 735
End
Begin VB.ComboBox CB_StartDay
Height = 300
Left = 3000
TabIndex = 5
Top = 1200
Width = 615
End
Begin VB.ComboBox CB_StartMonth
Height = 300
Left = 2040
TabIndex = 4
Top = 1200
Width = 615
End
Begin VB.ComboBox CB_StartYear
Height = 300
Left = 1080
TabIndex = 3
Top = 1200
Width = 735
End
Begin VB.ComboBox CB_GoodClass
Height = 300
Left = 1080
TabIndex = 2
Top = 720
Width = 1335
End
Begin VB.TextBox txtGoodName
Height = 270
Left = 1080
TabIndex = 1
Top = 240
Width = 1575
End
Begin VB.Label Label10
Caption = "日"
Height = 375
Left = 3600
TabIndex = 19
Top = 1800
Width = 255
End
Begin VB.Label Label9
Caption = "月"
Height = 255
Left = 2640
TabIndex = 18
Top = 1800
Width = 375
End
Begin VB.Label Label8
Caption = "年"
Height = 255
Left = 1800
TabIndex = 17
Top = 1800
Width = 255
End
Begin VB.Label Label7
Caption = "結束時間:"
Height = 375
Left = 120
TabIndex = 16
Top = 1800
Width = 1095
End
Begin VB.Label Label6
Caption = "日"
Height = 375
Left = 3600
TabIndex = 15
Top = 1200
Width = 375
End
Begin VB.Label Label5
Caption = "月"
Height = 255
Left = 2640
TabIndex = 14
Top = 1200
Width = 375
End
Begin VB.Label Label4
Caption = "年"
Height = 255
Left = 1800
TabIndex = 13
Top = 1200
Width = 375
End
Begin VB.Label Label3
Caption = "開始時間:"
Height = 255
Left = 120
TabIndex = 12
Top = 1320
Width = 975
End
Begin VB.Label Label2
Caption = "商品類別:"
Height = 375
Left = 120
TabIndex = 11
Top = 720
Width = 975
End
Begin VB.Label Label1
Caption = "商品名稱:"
Height = 375
Left = 120
TabIndex = 10
Top = 240
Width = 975
End
End
End
Attribute VB_Name = "FrmGetOutPrint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim i As Integer
Dim sql, startTime, endTime As String
Dim queryRs As ADODB.Recordset '保存查詢到的結果
Dim queryTargetRs As ADODB.Recordset '將要保存到報表源數據表的數據集
startTime = Me.CB_StartYear.Text & "-" & Me.CB_StartMonth.Text & "-" & Me.CB_StartDay.Text
endTime = Me.CB_EndYear.Text & "-" & Me.CB_EndMonth.Text & "-" & Me.CB_EndDay.Text
sql = "select * from getOutInfo where outTime >= '" & startTime & "'"
sql = sql & " and outTime <= '" & endTime & "'"
If Me.txtGoodName.Text <> "" Then
sql = sql & " and goodName like '%" & Me.txtGoodName.Text & "%'"
End If
If Me.CB_GoodClass.Text <> "" Then
sql = sql & " and goodClassName = '" & Me.CB_GoodClass.Text & "'"
End If
Call check_condatabase '連接數據庫
Set queryRs = cn.Execute(sql) '得到查詢結果
sql = "delete from queryGetOutInfo"
cn.Execute (sql) '首先刪除生成報表源數據表里的數據
Set queryTargetRs = New ADODB.Recordset '下面打開目標數據表的數據集并執行數據復制操作
queryTargetRs.open "select * from queryGetOutInfo", cn, adOpenStatic, adLockOptimistic
While Not queryRs.EOF
queryTargetRs.AddNew '添加記錄
For i = 0 To 6
queryTargetRs.Fields(i).Value = queryRs.Fields(i).Value
Next i
queryTargetRs.Update
queryRs.MoveNext '進入下一條記錄再重復進行復制操作
Wend
If DataEnvironment1.rsCommand2.State = adStateOpen Then
DataEnvironment1.rsCommand2.close
End If
DataEnvironment1.rsCommand2.open "select * from queryGetOutInfo", cn, adOpenStatic, adLockOptimistic
If DataEnvironment1.rsCommand2.EOF Then
MsgBox "對不起,沒有符合查詢條件的出庫信息記錄信息!"
Exit Sub
End If
GetOutInfoDataReport.Show '預覽報表
End Sub
Private Sub Form_Load()
Dim goodClassRs As ADODB.Recordset
Dim sql As String
Dim i As Integer
Call check_condatabase
sql = "select goodClassName from goodClass"
Set goodClassRs = cn.Execute(sql)
While Not goodClassRs.EOF
Me.CB_GoodClass.AddItem goodClassRs("goodClassName")
goodClassRs.MoveNext
Wend
Me.CB_StartYear.Text = CStr(Year(Date))
Me.CB_EndYear.Text = CStr(Year(Date))
If Month(Date) = 1 Then
Me.CB_StartMonth.Text = "12"
Me.CB_StartYear.Text = CStr(Year(Date) - 1)
Else
Me.CB_StartMonth.Text = CStr(Month(Date) - 1)
End If
Me.CB_EndMonth.Text = CStr(Month(Date))
Me.CB_StartDay.Text = CStr(Day(Date))
Me.CB_EndDay.Text = CStr(Day(Date))
For i = 2000 To 2100
Me.CB_StartYear.AddItem CStr(i)
Me.CB_EndYear.AddItem CStr(i)
Next i
For i = 1 To 12
Me.CB_StartMonth.AddItem CStr(i)
Me.CB_EndMonth.AddItem CStr(i)
Next i
For i = 1 To 31
Me.CB_StartDay.AddItem CStr(i)
Me.CB_EndDay.AddItem CStr(i)
Next i
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -