balu said:
Hi Dirk,
Thank you for your response.
Forms is empty here as you mentioned for opening the access by
accessapp.But, how to get the control list for each form in the access
application by forms documents containers method.Could i get the code
for this.
I haven't tested it, but you might try something like this:
'------ start of code ------
Dim AccessApp As Access.Application
Dim db As DAO.Database
Dim cnt As DAO.Container
Dim doc As DAO.Document
Dim frm As Access.Form
Dim ctl As Access.Control
Dim strOutput As String
Set AccessApp = New Access.Application
With AccessApp
.OpenCurrentDatabase app.path & "\ClmCD97.mdb"
Set db = .CurrentDb
Set cnt = db.Containers("Forms")
For Each doc In cnt.Documents
.DoCmd.OpenForm doc.Name, acDesign, _
WindowMode:=acHidden
Set frm = .Forms(doc.Name)
strOutput = "Form " & frm.Name & _
" has the following " & frm.Controls.Count & _
" controls:" & vbCrLf
For Each ctl In frm.Controls
strOutput = strOutput & ctl.Name & ", "
Next ctl
.DoCmd.Close acForm, frm.Name, acSaveNo
Set frm = Nothing
If right(strOutput, 2) = ", " Then
strOutput = Left(strOutput, Len(strOutput) - 2)
End If
MsgBox strOutput
Next doc
Set doc = Nothing
Set db = Nothing
.Quit acQuitSaveNone
End With
'------ end of code ------