最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

多條件查詢 Access數(shù)據(jù)庫功能模塊講解 VBA代碼編程實例

2022-05-01 16:31 作者:凌霄百科  | 我要投稿

Public filter_text As String? ? '定義為公共變量


Private Sub Command查詢_Click()

filter_text = ""

If Me.員工編號 <> "" Then

? ? If filter_text <> "" Then

? ? filter_text = filter_text & " and 員工編號 like '*" & Me.員工編號 & "*'"

? ? Else

? ? filter_text = "員工編號 like '*" & Me.員工編號 & "*'"

? ? End If

End If

If Me.部門 <> "" Then

? ? If filter_text <> "" Then

? ? filter_text = filter_text & " and 部門 like '*" & Me.部門 & "*'"

? ? Else

? ? filter_text = "部門 like '*" & Me.部門 & "*'"

? ? End If

End If

If Me.職位 <> "" Then

? ? If filter_text <> "" Then

? ? filter_text = filter_text & " and 職位 like '*" & Me.職位 & "*'"

? ? Else

? ? filter_text = "職位 like '*" & Me.職位 & "*'"

? ? End If

End If

If Me.姓名 <> "" Then

? ? If filter_text <> "" Then

? ? filter_text = filter_text & " and 姓名 like '*" & Me.姓名 & "*'"

? ? Else

? ? filter_text = "姓名 like '*" & Me.姓名 & "*'"

? ? End If

End If

If Me.銷售日期1 <> "" And Me.銷售日期2 <> "" Then

? ? If filter_text <> "" Then

? ? filter_text = filter_text & " and 銷售日期 between #" & Me.銷售日期1 & "# and #" & Me.銷售日期2 & "#"

? ? Else

? ? filter_text = "銷售日期 between #" & Me.銷售日期1 & "# and #" & Me.銷售日期2 & "#"

? ? End If

End If

If Me.銷售額1 <> "" And Me.銷售額2 <> "" Then

? ? If filter_text <> "" Then

? ? filter_text = filter_text & " and 銷售額 >= " & Me.銷售額1 & " and 銷售額<=" & Me.銷售額2

? ? Else

? ? filter_text = "銷售額 >= " & Me.銷售額1 & " and 銷售額<=" & Me.銷售額2

? ? End If

End If

'------------------------------篩選子窗體

If filter_text <> "" Then

Me.數(shù)據(jù)表子窗體.Form.Filter = filter_text

Me.數(shù)據(jù)表子窗體.Form.FilterOn = True

Else

Me.數(shù)據(jù)表子窗體.Form.FilterOn = False

End If

End Sub


Private Sub Command清空_Click()

員工編號.Value = ""

姓名.Value = ""

部門.Value = ""

職位.Value = ""

銷售日期1.Value = ""

銷售日期2.Value = ""

銷售額1.Value = ""

銷售額2.Value = ""

End Sub


Private Sub Command全部_Click()

Me.數(shù)據(jù)表子窗體.Form.FilterOn = False

End Sub


多條件查詢 Access數(shù)據(jù)庫功能模塊講解 VBA代碼編程實例的評論 (共 條)

分享到微博請遵守國家法律
宁德市| 佛山市| 邢台县| 彩票| 蒙城县| 洛浦县| 海丰县| 隆尧县| 长宁区| 禹州市| 聂荣县| 巴马| 枝江市| 贡觉县| 安吉县| 长兴县| 萨嘎县| 广平县| 伊通| 大冶市| 翼城县| 宁化县| 涞水县| 贵溪市| 绥宁县| 云梦县| 抚宁县| 满洲里市| 眉山市| 亚东县| 乳山市| 朝阳区| 长垣县| 墨竹工卡县| 延寿县| 建昌县| 霍城县| 得荣县| 汝州市| 九江市| 陈巴尔虎旗|