RecordSource property

  • Thread starter Thread starter mchd
  • Start date Start date
M

mchd

Hi,

I want to get the RecordSource property value for all forms in the current
database open or not

How to do it ? Any sample code ?

Thanks for ny help
 
Public Function ShowRecordSource()
Dim accObj As AccessObject
Dim strDoc As String

For Each accObj In CurrentProject.AllForms
strDoc = accObj.Name
If accObj.IsLoaded Then
Debug.Print strDoc, Forms(strDoc).RecordSource
Else
DoCmd.OpenForm strDoc, acDesign, windowmode:=acHidden
Debug.Print strDoc, Forms(strDoc).RecordSource
DoCmd.Close acForm, strDoc
End If
Next
End Function

If you are using an old version of Access, the AllForms collection is not
available. To get the names of the forms, use the Documents collection, or
this query:
SELECT [Name] FROM MsysObjects
WHERE (([Type] = -32768) AND ([Name] Not Like '~*'))
ORDER BY MsysObjects.Name;
 
Back
Top