MS Access Search

I have a need to search the record source for all forms and reports in Access 2007.  All record sources are in SQL 2005. In the past I was able to do something similar to this using the code attached. Can this code be modified to accomplish what I am trying to do? For instance I need to search all Forms & Reports to see if they are using vw_ClaimSupervisor.
Sub rpttest()


Dim rpt As Object
Dim strName As String

'For each report in the database
For Each rpt In CurrentProject.AllReports
  'Set strName = name of the report
  strName = rpt.Name
  'Open the report in design view, hidden
  DoCmd.OpenReport strName, acViewDesign, windowmode:=acHidden
    'If the record source is "Orders" then print the name of the report in the immediate window
    If Reports(strName).RecordSource = "Orders" Then
      Debug.Print strName
    End If
  'Close the report
  DoCmd.Close acReport, strName
Next

End Sub

Open in new window

mburk1968Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCCommented:
There is always Rick Fischers "Find and Replace" utility.

0
Dale FyeOwner, Developing Solutions LLCCommented:
To search queries, the code would look something like:

Dim qdf as DAO.Querydef

for each qdf in currentdb.querydefs
    if instr(qdf.SQL, "vw_ClaimSupervisor") > 0 then
       debug.print qdf.name
    end if
Next
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mburk1968Author Commented:
How do I execute it? I created a module for the code above but I get the macro dialog box when I try to run it.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.