Retrieve the SQL of forms recordsource

M

Morten Snedker

I'm using Access XP, ADP running against MS-SQL 2000.

The following code is used to search the recordsource of all forms for
a given expression:

'--
Dim strSearch As String, i As Integer
strSearch = "tblLYSSpecLokaler"

For Each obj In dbs.AllForms
DoCmd.OpenForm obj.Name, acDesign, , , , acHidden
If (InStr(1, Forms(obj.Name).RecordSource, strSearch) > 0)
Then
i = i + 1
Debug.Print "Forms " & obj.Name & " ---> " &
Forms(obj.Name).RecordSource
End If
DoCmd.Close acForm, obj.Name, acSaveNo
Next obj
'--

If the form is based on a view my search may fail. Is there a way to
extend the search so I can search the SQL-statement of the view as
well?


Regards /Snedker
 
?

???

Morten Snedker said:
I'm using Access XP, ADP running against MS-SQL 2000.

The following code is used to search the recordsource of all forms for
a given expression:

'--
Dim strSearch As String, i As Integer
strSearch = "tblLYSSpecLokaler"

For Each obj In dbs.AllForms
DoCmd.OpenForm obj.Name, acDesign, , , , acHidden
If (InStr(1, Forms(obj.Name).RecordSource, strSearch) > 0)
Then
i = i + 1
Debug.Print "Forms " & obj.Name & " ---> " &
Forms(obj.Name).RecordSource
End If
DoCmd.Close acForm, obj.Name, acSaveNo
Next obj
'--

If the form is based on a view my search may fail. Is there a way to
extend the search so I can search the SQL-statement of the view as
well?


Regards /Snedker
 
?

???

Morten Snedker said:
I'm using Access XP, ADP running against MS-SQL 2000.

The following code is used to search the recordsource of all forms for
a given expression:

'--
Dim strSearch As String, i As Integer
strSearch = "tblLYSSpecLokaler"

For Each obj In dbs.AllForms
DoCmd.OpenForm obj.Name, acDesign, , , , acHidden
If (InStr(1, Forms(obj.Name).RecordSource, strSearch) > 0)
Then
i = i + 1
Debug.Print "Forms " & obj.Name & " ---> " &
Forms(obj.Name).RecordSource
End If
DoCmd.Close acForm, obj.Name, acSaveNo
Next obj
'--

If the form is based on a view my search may fail. Is there a way to
extend the search so I can search the SQL-statement of the view as
well?


Regards /Snedker
 
?

???

Morten Snedker said:
I'm using Access XP, ADP running against MS-SQL 2000.

The following code is used to search the recordsource of all forms for
a given expression:

'--
Dim strSearch As String, i As Integer
strSearch = "tblLYSSpecLokaler"

For Each obj In dbs.AllForms
DoCmd.OpenForm obj.Name, acDesign, , , , acHidden
If (InStr(1, Forms(obj.Name).RecordSource, strSearch) > 0)
Then
i = i + 1
Debug.Print "Forms " & obj.Name & " ---> " &
Forms(obj.Name).RecordSource
End If
DoCmd.Close acForm, obj.Name, acSaveNo
Next obj
'--

If the form is based on a view my search may fail. Is there a way to
extend the search so I can search the SQL-statement of the view as
well?


Regards /Snedker
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top