首页
/
每日頭條
/
科技
/
access 使用vba查詢數據如何保存
access 使用vba查詢數據如何保存
更新时间:2025-11-15 17:56:58

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
推荐阅读
微星主闆AMD優化
微星主闆AMD優化
随着AMD在Computex2022上介紹了即将到來的Zen4架構Ryzen7000系列處理器及AM5平台,各大主闆廠商也開始忙碌起來。微星随即公布了其X670系列主闆陣容,包括了MEGX670EGODLIKE超神、MEGX670EACE戰...
2025-11-15
剪映最新高級版本怎麼去水印
剪映最新高級版本怎麼去水印
剪映最新高級版本怎麼去水印?1.開始創作——添加帶水印的視頻——特效——模糊,把模糊拉到完整的視頻——畫中畫——新增畫中畫——把新增視頻拉到與原視頻一樣的尺寸——蒙版——矩形——把矩形調整到與水印大小一樣的位置,點中間圓點,拉到水印的位置上...
2025-11-15
vlog文字朗讀
vlog文字朗讀
在演講、或者拍攝視頻時,不想拿着厚厚一疊講稿翻,也沒有準備專業的提詞器,可以試試這款便捷的提詞應用。卡片式提詞器在Hintapp中準備提詞内容,要根據你想要的「切換」方式進行選擇,這個應用是一個「卡片式」提詞器。同一個文檔中,設置一張或多張...
2025-11-15
蘋果手機信号不好怎麼辦
蘋果手機信号不好怎麼辦
蘋果手機信号不好怎麼辦?開關飛行模式,首先可以通過開關飛行模式來重置我們的網絡可以在【設置】裡面直接找到【飛行模式】直接開啟,開啟後稍等十幾秒之後,再将其關閉或者也可以直接上滑控制中心,找到【飛行模式】直接開啟關閉,看看信号有沒有變好,下面...
2025-11-15
手機如何錄音
手機如何錄音
手機如何錄音?首先在手機桌面找到“系統工具”,點開“錄音機”,下面我們就來聊聊關于手機如何錄音?接下來我們就一起去了解一下吧!手機如何錄音首先在手機桌面找到“系統工具”,點開“錄音機”。在錄音機界面,點擊紅色的“開始”按鈕就開始錄音了。如果...
2025-11-15
Copyright 2023-2025 - www.tftnews.com All Rights Reserved