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

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
推荐阅读
王者榮耀s9新規定
王者榮耀s9新規定
王者榮耀S8賽季已經接近尾聲,本月中旬将會更新S9賽季的版本,那麼在S9賽季,遊戲中都有哪些變化呢?1、新增夫子的試煉系統在遊戲中加入了一個【夫子的試煉系統】,在玩家完成比賽之後會随機獲得“夫子的試煉道具”;使用該道具可以獲得答題機會,完成...
2026-05-15
本田雅閣各方面性能
本田雅閣各方面性能
日系中級車三劍客中的凱美瑞已經率先完成了換代,并且國産版本也與大家見面了,多種風格的外觀,以及成熟的混動系統,都是看得出實力的強大。而我們的本田雅閣也緊随其後的推出的全新的換代産品,雖然也是向運動風格轉變,但路子完全和凱美瑞不同。雖然目前還...
2026-05-15
奧巴馬中單打法
奧巴馬中單打法
哈喽,大家好!我是菲茲。相信很多在玩LOL手遊的玩家都有這樣一個認知,那就是輔助在隊伍當中的重要性!雖然說作為一個輔助不需要補兵,但是視野的查探、對于我方C位的保護以及必要的控制都是十分考驗玩家意識的。那麼在新版本當中,她成最穩上分選手,控...
2026-05-15
什麼軟件可以做電子版的報表
什麼軟件可以做電子版的報表
當然是Smartbi了,它的Excel電子表格可是以Excel(WPS表格)為設計器,兼具Web報表軟件和辦公軟件的優勢哦。就是說你在熟悉的Excel界面上,使用Excel的表格、樣式、模闆、公式、函數、圖形等功能來制作報表,借助BI服務器...
2026-05-15
順豐最新信息洩露
順豐最新信息洩露
順豐最新信息洩露?針對3億條用戶數據遭洩漏的傳言,國内民營快遞巨頭順豐作出回應,接下來我們就來聊聊關于順豐最新信息洩露?以下内容大家不妨參考一二希望能幫到您!順豐最新信息洩露針對3億條用戶數據遭洩漏的傳言,國内民營快遞巨頭順豐作出回應。9月...
2026-05-15
Copyright 2023-2026 - www.tftnews.com All Rights Reserved