📄 reportitem.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "ReportItem"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Public EName As String '英文名称
Public CName As String '中文名称
Public FieldType As ADODB.DataTypeEnum '字段类型
Public Function GenFilter(ByVal Condition As String, Value, Optional ConditionID As Integer = 0)
Dim strValue As String
Dim strSQL As String
'------------------------
'产生SQL Filter句段
'------------------------
strValue = CStr(Value)
If Left(strValue, 1) = """" Then strValue = Mid(strValue, 2)
If Right(strValue, 1) = """" Then strValue = Right(strValue, Len(strValue) - 1)
If ConditionID = TipAtSerial - 1 Then Exit Function
Select Case FieldType
Case adVarWChar, adChar, adVarChar
strSQL = EName & " " & Condition & " '" & strValue & "'"
Select Case Condition
' Case "<>" '如果是"<>",则要同时允许查询为空值的记录(否则这些记录将不显示)
' strSQL = strSQL & " OR " & EName & " = NULL"
Case "包含" '包含(用*号表示)
strSQL = EName & " LIKE '*" & strValue & "*'"
End Select
Case adDate
strSQL = EName & " " & Condition & " #" & strValue & "#"
Case Else
strSQL = EName & " " & Condition & " " & strValue
End Select
If ConditionID > 0 Then strSQL = " AND " & strSQL
GenFilter = strSQL
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -