📄 ufawen_dispaly.ctl
字号:
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc datPrimaryRS
Height = 330
Left = 90
Top = 4890
Width = 2325
_ExtentX = 4101
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = 13432047
ForeColor = -2147483640
Orientation = 0
Enabled = -1
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
Begin VB.Label lblLabels
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "共有记录数:"
ForeColor = &H80000008&
Height = 255
Index = 15
Left = 2490
TabIndex = 19
Top = 4950
Width = 990
End
Begin VB.Label lbl记录数
Appearance = 0 'Flat
BackColor = &H00FFF8E7&
Caption = "0"
ForeColor = &H80000008&
Height = 240
Left = 3840
TabIndex = 18
Top = 4920
Width = 615
End
End
Attribute VB_Name = "UFaWen_Display"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Public pIP As String
Public pConn As String
Dim strUserName As String
Private Sub cmdAll_Click()
datPrimaryRS.Recordset.Filter = ""
datPrimaryRS.Refresh
SSTab1.Tab = 1
End Sub
Private Sub cmdCancel_Click()
SSTab1.Tab = 1
End Sub
'Private Sub cmdFaWen_Click()
' If Not (Adodc4.Recordset.EOF Or Adodc4.Recordset.BOF) Then
' txtFields(4).Text = Adodc4.Recordset.Fields("事由").Value
' txtFields(9).Text = Adodc4.Recordset.Fields("主题词").Value
' txtFields(5).Text = Adodc4.Recordset.Fields("内容").Value
'
' End If
'
'
' SSTab1.Tab = 0
'End Sub
Private Sub cmdGaoZhi_Click()
SSTab1.Tab = 3
End Sub
Private Sub cmdFilter_Click()
Dim strFilter As String
'生成filter字符串
strFilter = ""
If Trim(txtFields(5).Text) <> "" Then
strFilter = "年度=" & Trim(txtFields(5).Text)
End If
If Trim(txtFields(6).Text) <> "" Then
If strFilter = "" Then
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 DataCombo1_LostFocus()
If datPrimaryRS.Recordset Is Nothing Or datPrimaryRS.Recordset.EditMode <> adEditAdd Then Exit Sub
Adodc1.Recordset.Find "部门id=" & datPrimaryRS.Recordset.Fields("部门id").Value
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
If Not (datPrimaryRS.Recordset.BOF Or datPrimaryRS.Recordset.EOF) Then
datPrimaryRS.Recordset.MoveLast
n年度 = datPrimaryRS.Recordset.Fields("年度").Value
n序号 = datPrimaryRS.Recordset.Fields("序号").Value + 1
Else
n年度 = Format(Now(), "yyyy")
n序号 = 1
End If
datPrimaryRS.Recordset.AddNew
txtFields(0).Text = n年度
txtFields(1).Text = n序号
' DTPicker1(0).Value = Now()
' DTPicker1(1).Value = Now()
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 adAffectAll
' Exit Sub
'UpdateErr:
' MsgBox Err.Description
'End Sub
Private Sub txtFields_Change(Index As Integer)
If datPrimaryRS.Recordset Is Nothing Then Exit Sub
If datPrimaryRS.Recordset.EOF Or datPrimaryRS.Recordset.BOF Then Exit Sub
If datPrimaryRS.Recordset.EditMode = adEditAdd And Index < 2 Then
txtFields(2).Text = "交规" & Adodc1.Recordset.Fields("部门简称").Value & "字[" & txtFields(0).Text & "]" & Format(txtFields(1).Text, "000") & "号"
End If
End Sub
Private Sub UserControl_Initialize()
pConn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=OA;Data Source=lzy"
strUserName = GetSetting("JGYOA", "Login", "UserName", "")
With datPrimaryRS
.ConnectionString = pConn
.RecordSource = "select 年度,序号,部门ID,文件编号,文件名称,发送单位,文件日期,发文日期,文件页数,附件数,主题词,抄送,签发人ID,文件分类ID,相关文件 from 发文登记"
.Refresh
End With
With Adodc1
.ConnectionString = pConn
.RecordSource = "部门"
.Refresh
End With
With Adodc2
.ConnectionString = pConn
.RecordSource = "签发人"
.Refresh
End With
With Adodc3
.ConnectionString = pConn
.RecordSource = "文件分类"
.Refresh
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -