首页
/
每日頭條
/
科技
/
access 使用vba查詢數據如何保存
access 使用vba查詢數據如何保存
更新时间:2025-07-02 12:39:00

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
推荐阅读
電腦怎麼深度隐藏文件夾
電腦怎麼深度隐藏文件夾
把你電腦裡的秘密都放進桌面這個透明文件夾裡,别人根本發現不了。首先在桌面新建一個文件夾。按住ctrl退格鍵回車,這樣就隐藏文件名了。接着右擊文件夾,選擇屬性,點擊自定義,選擇更改圖标,找到這個空白圖标,點擊确定,點擊應用,再次點擊确定設置完...
2025-07-02
windowsservermanager未開啟
windowsservermanager未開啟
一、前言前一段由于電腦上安裝的adobeIllustratorcs5到期了,是在是找不到可以用的序列号了之後,就考慮升級電腦上illustrator版本為cs6版本了,從網站下載安裝cs6之後,每次運行軟件,電腦總會提示“”adobecs6...
2025-07-02
知米設置鎖屏後不顯示
知米設置鎖屏後不顯示
知米設置鎖屏後不顯示?它可以一鍵釋放系統内存,清理系統垃圾,給手機提速謝謝望采納,下面我們就來說一說關于知米設置鎖屏後不顯示?我們一起去了解并探讨一下這個問題吧!知米設置鎖屏後不顯示它可以一鍵釋放系統内存,清理系統垃圾,給手機提速。謝謝。望...
2025-07-02
戴爾xps8700有必要升級顯卡嗎
戴爾xps8700有必要升級顯卡嗎
IT之家8月7日消息戴爾XPS159510是戴爾今年推出的高端筆記本電腦,搭載英特爾H45處理器,并配備了RTX3050Ti顯卡。此外,XPS159510還擁有OLED屏的版本,也就是這個版本,在前幾天的性能測試中有一點翻車。據NoteBo...
2025-07-02
手機掉水裡了應該怎麼處理
手機掉水裡了應該怎麼處理
前幾天,一時手抖,不小心将平闆給掉水裡了,手疾眼快撈了出來,趕緊摳下外殼,慌慌張張地扯了塊毛巾擦了外面的水,手機還開着,我點了下還可以運行,忙關了機,然後,甩了下,裡面還有水出來,我沒多想,又使勁地甩,直到沒水出來,心裡忐忑不安,又不敢開機...
2025-07-02
Copyright 2023-2025 - www.tftnews.com All Rights Reserved