📄 zfjl.frm
字号:
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = " "
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 = "zfjl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Resize()
On Error Resume Next
'当窗体调整时会调整网格
Me.DTPicker1.Value = Now - 30
Me.DTPicker2.Value = Now
grdDataGrid.Width = Me.ScaleWidth - 300 - grdDataGrid.Left * 2
End Sub
Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
End Sub
Private Sub datPrimaryRS_Error(ByVal ErrorNumber As Long, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, fCancelDisplay As Boolean)
'错误处理程序代码置于此处
'想要忽略错误,注释掉下一行
'想要捕获它们,在此添加代码以处理它们
MsgBox "Data error event hit err:" & Description
End Sub
Private Sub datPrimaryRS_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
'验证代码置于此处
'下列动作发生时该事件被调用
Dim bCancel As Boolean
Select Case adReason
Case adRsnAddNew
Case adRsnClose
Case adRsnDelete
Case adRsnFirstChange
Case adRsnMove
Case adRsnRequery
Case adRsnResynch
Case adRsnUndoAddNew
Case adRsnUndoDelete
Case adRsnUndoUpdate
Case adRsnUpdate
End Select
If bCancel Then adStatus = adStatusCancel
End Sub
Private Sub cmdRefresh_Click()
'只有多用户应用程序需要
'On Error GoTo RefreshErr
datPrimaryRS.ConnectionString = connetstr
datPrimaryRS.RecordSource = "select hth as 票号,ch as 车号,mz as 毛重,pz as 皮重,jz as 净重,hwm as 货物名,shr as 收货人,fhr as 发货人,dhdd as 到货地点,sby as 司磅员,sj as 检斤时间,id as 流水号 from " & jl_sqlstr & " where zflj>0 and sj>='" & Format(DTPicker1.Value, "yyyy-mm-dd") & "' and sj <='" & Format(DTPicker2.Value + 1 + 1, "yyyy-mm-dd") & "' Order by sj"
datPrimaryRS.refresh
Set Me.grdDataGrid.DataSource = Me.datPrimaryRS
Me.grdDataGrid.refresh
Exit Sub
RefreshErr:
MsgBox Err.Description
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
'##################################################################
Private Sub curtprinter1_ClosePreview()
frmcx.CurtPrinter1.Visible = False
' mnuManual.Enabled = False
End Sub
'如果每次调整预览比例好重新生成预览的话,请将AutoRedraw设置为FALSE,然后在下面的事件添入要重画的代码
'##################################################################
'## 过程名称:curtprinter1_NeedRedraw
'## 参数: 无
'##################################################################
Private Sub CurtPrinter1_NeedRedraw()
PrintContent
End Sub
'写入打印叶脚的代码
'##################################################################
'## 过程名称:CurtPrinter1_PrintFooter
'## 参数:CurrentPage 为Long型
'## 参数:LeftText 为String型
'## 参数:CenterText 为String型
'## 参数:RightText 为String型
'##################################################################
Private Sub CurtPrinter1_PrintFooter(CurrentPage As Long, LeftText As String, CenterText As String, RightText As String)
LeftText = jl_zgdw
CenterText = Format(Now, "yyyy年m月d日")
RightText = "其他信息"
End Sub
'写入打印页眉的代码
'##################################################################
'## 过程名称:CurtPrinter1_PrintHeader
'## 参数:CurrentPage 为Long型
'## 参数:LeftText 为String型
'## 参数:CenterText 为String型
'## 参数:RightText 为String型
'##################################################################
Private Sub CurtPrinter1_PrintHeader(CurrentPage As Long, LeftText As String, CenterText As String, RightText As String)
LeftText = Date
CenterText = jl_qym
RightText = "这是第 " & CurrentPage & " 页"
End Sub
'点击了预览窗体或直接调用ShowPrinter后,点击了打印机窗口的确定,引发打印代码,打印到打印机上!
'##################################################################
'## 过程名称:curtprinter1_RealPrint
'## 参数: 无
'##################################################################
Private Sub curtprinter1_RealPrint()
PrintContent Printer
End Sub
'如果隐藏工具条,仍可以通过简单的编程控制预览
'##################################################################
'## 过程名称:mnuPageDown_Click
'## 参数: 无
'##################################################################
Private Sub mnuPageDown_Click()
frmcx.CurtPrinter1.PageDown
End Sub
'##################################################################
'## 过程名称:mnuPageSetup_Click
'## 参数: 无
'##################################################################
Private Sub mnuPageSetup_Click()
frmcx.CurtPrinter1.PageSetup
End Sub
'##################################################################
'## 过程名称:mnuPageUp_Click
'## 参数: 无
'##################################################################
Private Sub mnuPageUp_Click()
frmcx.CurtPrinter1.PageUp
End Sub
'##################################################################
'## 过程名称:mnuZoom_Click
'## 参数: 无
'##################################################################
Private Sub mnuZoom_Click()
frmcx.CurtPrinter1.Zoom = Val(InputBox("请输入0-200之间的数字")) '0代表整页预览
End Sub
'##################################################################
'## 过程名称:mnuOrientation_Click
'## 参数: 无
'##################################################################
Private Sub mnuOrientation_Click()
frmcx.CurtPrinter1.Orientation = IIf(frmcx.CurtPrinter1.Orientation = 1, 2, 1)
End Sub
'##################################################################
'## 过程名称:mnuPaperSize_Click
'## 参数: 无
'##################################################################
Private Sub mnuPaperSize_Click()
frmcx.CurtPrinter1.PaperSize = InputBox("请输入打印纸型号:")
End Sub
'##################################################################
'## 过程名称:CloneFont
'## 参数:Dest 为StdFont型
'## 参数:Src 为StdFont型
'##################################################################
Private Sub CloneFont(Dest As StdFont, Src As StdFont)
With Dest
.Bold = Src.Bold
.Charset = Src.Charset
.Italic = Src.Italic
.Name = Src.Name
.Size = Src.Size
.Strikethrough = Src.Strikethrough
.Underline = Src.Underline
.Weight = Src.Weight
End With
End Sub
'##################################################################
'## 过程名称:PrintContent
'## 参数:Optional 为ntDevice As Printer型
'##################################################################
Public Sub PrintContent(Optional PrintDevice As Printer)
Const TableStartX = 10
If PrintDevice Is Nothing Then
CurtPrinter1.StartPrint toPreview '预览
Else
CurtPrinter1.StartPrint toPrinter '打印到打印机
End If
Dim strr
With CurtPrinter1
'一些图形方法的演示
'重新开始一页,直接打印报表,注意,它会自动换页,如果你设定了标题,它也自动打哦:)
.NewPage
'直接打印MSHFlexGrid
.DirectPrint Me.grdDataGrid, "作废重车纪录"
.TextOut " "
.TextOut " "
.TextOut "说明:<毛重>对应统计的是(平均毛重),<皮重>对应统计的是(平均皮重),<净重>对应统计的是(累计净重)。"
.EndDoc
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -