首页
/
每日頭條
/
科技
/
access 使用vba查詢數據如何保存
access 使用vba查詢數據如何保存
更新时间:2026-11-11 08:10:45

access 使用vba查詢數據如何保存?Public filter_text As String '定義為公共變量,今天小編就來聊一聊關于access 使用vba查詢數據如何保存?接下來我們就一起去研究一下吧!

access 使用vba查詢數據如何保存(Access數據庫功能模塊講解)1

access 使用vba查詢數據如何保存

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.數據表子窗體.Form.Filter = filter_text

Me.數據表子窗體.Form.FilterOn = True

Else

Me.數據表子窗體.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.數據表子窗體.Form.FilterOn = False

End Sub

,
Comments
Welcome to tft每日頭條 comments! Please keep conversations courteous and on-topic. To fosterproductive and respectful conversations, you may see comments from our Community Managers.
Sign up to post
Sort by
Show More Comments
推荐阅读
12種電工開關圖解
12種電工開關圖解
開關是一種應用非常廣泛的主令電器,是控制電路閉合、斷開的電氣部件,主要用于對自動控制系統電路發出操作指令,從而實現對電路的自動控制。(一)開關的功能特性:開關根據結構功能的不同,較常見的有開啟式負荷開關、斷路器開關、按鈕開關、位置檢測開關及...
2026-11-11
戴森吸塵器最新型号是哪個
戴森吸塵器最新型号是哪個
自進入疫情以來的這兩年時間裡,洗地機以及全自動掃地機這兩大類清潔電器可謂是異軍突起,市場上升勢頭迅猛,進而侵蝕掉了不少清潔電器的銷售份額。不過從站内搜索熱詞以及熱銷單品排行來看,手持吸塵器的銷量以及關注度仍然是非常強勁,尤其是有着手持吸塵器...
2026-11-11
網紅被爆出
網紅被爆出
據英國《每日郵報》8月21日報道,26歲的坎迪爾·巴洛克在2016年7月被她的哥哥瓦西姆“榮譽謀殺”,在坎迪爾的家人今年8月21日正式向法院提出申請後,可能會被無罪釋放。​“榮譽謀殺”是指在巴基斯坦,女性因所謂“不檢點”的行為遭到親人的“處...
2026-11-11
windows7如何快速截圖
windows7如何快速截圖
日常工作中經常需要截圖,都都要借助第三方軟件來截圖,下面說一下Win7電腦全屏截圖及部分截圖的方法。将鍵盤的屏幕截圖按鈕PrScrn按鈕,按PrScrn按鈕截取整個屏幕,CtrlPrScrn組合鍵可截取屏幕截屏。按下PrScrn按鈕後,我們...
2026-11-11
楊洋玩什麼遊戲比較好
楊洋玩什麼遊戲比較好
提及楊洋,就想起他帥氣的臉龐和笑眯眯的眼睛。楊洋的帥自然天成、精緻幹淨,據說他考入軍藝時,大半個校園的女生都跑去看他,隻因為他太帥了。自從出道以來,楊洋就留下了《紅樓夢》《左耳》《旋風少女》《微微一笑很傾城》《三生三世十裡桃花》等優質作品,...
2026-11-11
Copyright 2023-2026 - www.tftnews.com All Rights Reserved