⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmfahan.frm

📁 公文管理系统》是一套通过行文收发
💻 FRM
📖 第 1 页 / 共 5 页
字号:
            strFilter = "序号=" & Trim(txtFields(6).Text)
        Else
            strFilter = strFilter & " and 序号=" & Trim(txtFields(6).Text)
        End If
    End If
    If DataCombo4.BoundText <> "" Then
        If strFilter = "" Then
            strFilter = "部门ID=" & DataCombo4.BoundText
        Else
            strFilter = strFilter & " and 部门ID=" & DataCombo4.BoundText
        End If
    End If
    If Not IsNull(DTPicker1(2).Value) Then
        If strFilter = "" Then
            strFilter = "发文日期 >= #" & Format(DTPicker1(2).Value, "Short Date") & "#"
        Else
            strFilter = strFilter & " and 发文日期 >= #" & Format(DTPicker1(2).Value, "Short Date") & "#"
        End If
    End If
    If Not IsNull(DTPicker1(3).Value) Then
        If strFilter = "" Then
            strFilter = "发文日期 <= #" & Format(DTPicker1(3).Value, "Short Date") & "#"
        Else
            strFilter = strFilter & " and 发文日期 <= #" & Format(DTPicker1(3).Value, "Short Date") & "#"
        End If
    End If
    If txtFields(10).Text <> "" Then
        If strFilter = "" Then
            strFilter = "主题词 like '%" & txtFields(10).Text & "%'"
        Else
            strFilter = strFilter & " and 主题词 like '%" & txtFields(10).Text & "%'"
        End If
    End If
    datPrimaryRS.Recordset.Filter = ""               'adFilterNone
    datPrimaryRS.Recordset.Filter = strFilter
    SSTab1.Tab = 1
End Sub

Private Sub cmdGaoZhi_Click()
  SSTab1.Tab = 3
  
End Sub

Private Sub cmdPrint_Click()
    Dim strSQL As String
    Dim rsTmp As New ADODB.Recordset
    Dim conn As New ADODB.Connection
    Dim oWrd As Object, i As Integer

    Set oWrd = CreateObject("Word.Application")
    oWrd.Visible = True
    oWrd.Activate
    oWrd.Documents.Add

    With oWrd.ActiveDocument.PageSetup
        .TopMargin = 60
        .BottomMargin = 40
        .LeftMargin = 66
        .RightMargin = 66
        .HeaderDistance = 30
        .FooterDistance = 48
        .PageWidth = 595.3
        .PageHeight = 841.9
    End With
    
    With oWrd.Selection
      
      .ParagraphFormat.Alignment = 3
      .Font.Underline = 1
      .Font.Size = 20    '小四
      .Font.Name = "宋体"
      .Font.Bold = True
      .TypeText "文件发送单"
      .Font.Underline = 0
      .Font.Size = 14
      .TypeText Space(36) & txtFields(0).Text & "发" & Format(txtFields(1).Text, "000")
      .TypeParagraph
      
      '部门
      .ParagraphFormat.Alignment = 3
      .ParagraphFormat.SpaceBefore = 24
      .ParagraphFormat.LineSpacing = 20
      .Font.Size = 11    '五号
      .Font.Name = "宋体"
      .Font.Bold = False
      .TypeText "部门名称:" & Space(2) & DataCombo1.Text
      .TypeParagraph
            
      '文件编号
      .ParagraphFormat.Alignment = 3
      .ParagraphFormat.SpaceBefore = 0
      .TypeText "文件编号:" & Space(2) & txtFields(2).Text
      .TypeParagraph
      
      '文件名称
      .ParagraphFormat.Alignment = 3
      .TypeText "文件名称:" & Space(2) & txtFields(4).Text
      .TypeParagraph
      
      '文件日期、发文日期
      .ParagraphFormat.Alignment = 3
      .TypeText "文件日期:" & Space(2) & Format(DTPicker1(0).Value, "yyyy-mm-dd") & Space(10) & "发文日期:" & Space(2) & Format(DTPicker1(1).Value, "yyyy-mm-dd")
      .TypeParagraph
      
      '文件页数、附件数
      .ParagraphFormat.Alignment = 3
      .TypeText "文件页数:" & Space(2) & txtFields(7).Text & Space(19) & "附件数:" & Space(2) & txtFields(8).Text
      .TypeParagraph
      .TypeParagraph
      .Font.Size = 10.5
      .ParagraphFormat.LineSpacing = 15
      
      conn.ConnectionString = pConn
      conn.Open
    
      '签字表格
      strSQL = "select 签发人姓名 from 签发人 order by 签发人排序"
      rsTmp.Open strSQL, conn, adOpenStatic, adLockReadOnly
      rsTmp.MoveLast
      rsTmp.MoveFirst
      i = rsTmp.RecordCount
      .Tables.Add Range:=.Range, NumRows:=Int(i / 2 + 0.5) + 1, NumColumns:=8  ', DefaultTableBehavior:=1, AutoFitBehavior:=0
'      .Cells.VerticalAlignment = 1
'      .Tables(1).Columns(1).PreferredWidthType = 3
'      .Tables(1).Columns(1).PreferredWidth = oWrd.CentimetersToPoints(1.8)
'      .MoveRight unit:=12
'      .Tables(1).Columns(1).PreferredWidthType = 3
'      .Tables(1).Columns(1).PreferredWidth = oWrd.CentimetersToPoints(2)
'      .MoveRight unit:=12
'      .Tables(1).Columns(1).PreferredWidthType = 3
'      .Tables(1).Columns(1).PreferredWidth = oWrd.CentimetersToPoints(2.4)
'      .MoveRight unit:=12
'      .Tables(1).Columns(1).PreferredWidthType = 3
'      .Tables(1).Columns(1).PreferredWidth = oWrd.CentimetersToPoints(2.4)
'      .MoveRight unit:=12
'      .Tables(1).Columns(1).PreferredWidthType = 3
'      .Tables(1).Columns(1).PreferredWidth = oWrd.CentimetersToPoints(1.8)
'      .MoveRight unit:=12
'      .Tables(1).Columns(1).PreferredWidthType = 3
'      .Tables(1).Columns(1).PreferredWidth = oWrd.CentimetersToPoints(2)
'      .MoveRight unit:=12
'      .Tables(1).Columns(1).PreferredWidthType = 3
'      .Tables(1).Columns(1).PreferredWidth = oWrd.CentimetersToPoints(2.4)
'      .MoveRight unit:=12
'      .Tables(1).Columns(1).PreferredWidthType = 3
'      .Tables(1).Columns(1).PreferredWidth = oWrd.CentimetersToPoints(2.4)
'      .MoveLeft unit:=12, Count:=7
      .ParagraphFormat.Alignment = 1
      .TypeText Text:="院长"
      .MoveRight unit:=12
      .ParagraphFormat.Alignment = 1
      .TypeText Text:="签字"
      .MoveRight unit:=12
      .ParagraphFormat.Alignment = 1
      .TypeText Text:="送文日期"
      .MoveRight unit:=12
      .ParagraphFormat.Alignment = 1
      .TypeText Text:="还文日期"
      .MoveRight unit:=12
      .ParagraphFormat.Alignment = 1
      .TypeText Text:="院长"
      .MoveRight unit:=12
      .ParagraphFormat.Alignment = 1
      .TypeText Text:="签字"
      .MoveRight unit:=12
      .ParagraphFormat.Alignment = 1
      .TypeText Text:="送文日期"
      .MoveRight unit:=12
      .ParagraphFormat.Alignment = 1
      .TypeText Text:="还文日期"
      .MoveRight unit:=12
      If Not rsTmp.EOF Then
        .TypeText Text:=rsTmp.Fields("签发人姓名").Value
        rsTmp.MoveNext
      End If
      Do While Not rsTmp.EOF
        .MoveRight unit:=12, Count:=4
        .TypeText Text:=rsTmp.Fields("签发人姓名").Value
        rsTmp.MoveNext
      Loop
      
      .MoveDown unit:=5, Count:=1
      .TypeParagraph
    
      '部门表格
      strSQL = "select 部门名称 from 部门 order by 部门名称"
      rsTmp.Close
      rsTmp.Open strSQL, conn, adOpenStatic, adLockReadOnly
      rsTmp.MoveLast
      rsTmp.MoveFirst
      i = rsTmp.RecordCount
      .Tables.Add Range:=.Range, NumRows:=i + 2, NumColumns:=5  ', DefaultTableBehavior:=1, AutoFitBehavior:=0
'      .Cells.VerticalAlignment = 1
      .TypeText Text:="部门"
      .MoveRight unit:=12
      .TypeText Text:="送文"
      .MoveRight unit:=12, Count:=2
      .TypeText Text:="还文"
      .MoveRight unit:=12, Count:=3
      .ParagraphFormat.Alignment = 1
      .TypeText Text:="签字"
      .MoveRight unit:=12
      .ParagraphFormat.Alignment = 1
      .TypeText Text:="日期"
      .MoveRight unit:=12
      .ParagraphFormat.Alignment = 1
      .TypeText Text:="签字"
      .MoveRight unit:=12
      .ParagraphFormat.Alignment = 1
      .TypeText Text:="日期"
      .MoveUp unit:=5, Count:=1
      .MoveLeft unit:=1, Count:=1, Extend:=1
      .Cells.Merge
      .ParagraphFormat.Alignment = 1
      .MoveLeft unit:=1, Count:=2
      .MoveLeft unit:=1, Count:=1, Extend:=1
      .Cells.Merge
      .ParagraphFormat.Alignment = 1
      .MoveLeft unit:=1, Count:=2
      .MoveDown unit:=5, Count:=1, Extend:=1
      .ParagraphFormat.Alignment = 1
      .Cells.Merge
      Do While Not rsTmp.EOF
        .MoveDown unit:=5
        .TypeText Text:=rsTmp.Fields("部门名称").Value
        rsTmp.MoveNext
      Loop
      
      .HomeKey unit:=6

    End With

    Set oWrd = Nothing
    Set conn = Nothing
    Set rsTmp = Nothing

'    Set 打印文件发送单.Report = Nothing
'    打印文件发送单.Report.TextBM.SetText DataCombo1.Text
'    打印文件发送单.Report.TextWJBH.SetText txtFields(2).Text
'    打印文件发送单.Report.TextWJMC.SetText txtFields(4).Text
'    打印文件发送单.Report.TextWJRQ.SetText Format(DTPicker1(0).Value, "yyyy-mm-dd")
'    打印文件发送单.Report.TextSWRQ.SetText Format(DTPicker1(1).Value, "yyyy-mm-dd")
'    打印文件发送单.Report.TextWJYS.SetText txtFields(7).Text
'    打印文件发送单.Report.TextFJS.SetText txtFields(8).Text
'    打印文件发送单.Show vbModal
  
End Sub

Private Sub DataCombo1_LostFocus()

  If datPrimaryRS.Recordset Is Nothing Or datPrimaryRS.Recordset.EditMode <> adEditAdd Then Exit Sub
    
'  Adodc1.Recordset.Find "部门id=" & datPrimaryRS.Recordset.Fields("部门id").Value
    
    Adodc1.Recordset.Find "部门id=" & DataCombo1.BoundText
  
  txtFields(2).Text = "交规" & Adodc1.Recordset.Fields("部门简称").Value & "字[" & txtFields(0).Text & "]" & Format(txtFields(1).Text, "000") & "号"
  
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_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
  '为这个 recordset 显示当前记录位置
  datPrimaryRS.Caption = CStr(datPrimaryRS.Recordset.AbsolutePosition)
  lbl记录数.Caption = CStr(datPrimaryRS.Recordset.RecordCount)

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 cmdAdd_Click()
  On Error GoTo AddErr
  Dim n年度 As Integer, n序号 As Integer
  
  datPrimaryRS.Recordset.MoveLast
  n年度 = datPrimaryRS.Recordset.Fields("年度").Value
  n序号 = datPrimaryRS.Recordset.Fields("序号").Value + 1
  
  datPrimaryRS.Recordset.AddNew
  
  txtFields(0).Text = n年度
  txtFields(1).Text = n序号
  
  Exit Sub
AddErr:
  MsgBox Err.Description
End Sub

Private Sub cmdDelete_Click()
  On Error GoTo DeleteErr
  
    Dim nYN As Byte
    
     nYN = MsgBox("您正准备删除当前记录。" & Chr(13) & Chr(13) & _
        "假如您单击“是”,您将不能撤消这个删除操作。" & Chr(13) & _
        "您确认删除这条记录吗?", vbExclamation + vbYesNo)
    
    If nYN = vbYes Then
      With datPrimaryRS.Recordset
            If .EOF And .BOF Then Exit Sub
            .Delete
            .MoveNext
            
            If .RecordCount > 0 And .EOF Then
                .MoveLast
                ElseIf .RecordCount = 0 Then .MovePrevious
            End If
      End With
    End If

  Exit Sub
DeleteErr:
  MsgBox Err.Description
End Sub

Private Sub cmdRefresh_Click()
  '只有多用户应用程序需要
  On Error GoTo RefreshErr
  datPrimaryRS.Refresh
  Exit Sub
RefreshErr:
  MsgBox Err.Description
End Sub

Private Sub cmdRefresh1_Click()
  '只有多用户应用程序需要
  On Error GoTo RefreshErr
  Adodc4.Refresh
  Exit Sub
RefreshErr:
  MsgBox Err.Description
End Sub

Private Sub cmdUpdate_Click()
  On Error GoTo UpdateErr

  datPrimaryRS.Recordset.UpdateBatch adAff

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -