我的问题很简单,但我的访问数据库有多个查询,我想编写一个自动过程来检查任何查询中是否存在某个关键字。此自动化过程可以是查询,也可以是VBA。有人可以告诉我从哪里开始?
提前致谢!
答案 0 :(得分:2)
我写这篇文章的目的完全不同 - 但它可能会给你一个开始的地方。它会查看所有查询,查找特定字符串并将其替换为另一个字符串。
Function MassChange(F_string, T_string)
Dim DB As Database
Dim QD As QueryDef
Dim S As String
Set DB = CurrentDb
For Each QD In DB.QueryDefs
S = QD.SQL
If InStr(S, F_string) > 0 Then
S = Replace(S, F_string, T_string)
QD.SQL = S
End If
Next QD
MsgBox ("done")
End Function
答案 1 :(得分:1)
@vivi使用@ Don-George的答案,但如果您只想要查询的名称,请替换中间部分:
$scriptPath = "c:\\Project"
$scriptFilter = "*.ps1"
( Get-ChildItem -Path $scriptPath -Filter $scriptFilter -Recurse | Select-String -Pattern "function" ) | %{ $_.Line.Substring(9) }