Listing controls on open form

Idris

Registered User.
Local time
Today, 17:19
Joined
Nov 9, 2005
Messages
67
Dear Friends

How do I list al the controls on an open form including mutiple subforms

Please advice
 
Hmm, I've seen the code before. I know its something like this

For Each ctl in me.form
loop code
next ctl

Just put whatever you need in the "loop code section"

Hope this helps.

alteque
 
It doesnt help as the loop code section only list the controls in the main form and not the subforms controls

I am looking for a way to locate the controls on multiple subforms - Thanks
 
How do I list al the controls on an open form including mutiple subforms

Where to you want to "List" them?

Or

Do you want to refer to them?
 
I want to refer them based on the users selections on the main form

refering means i want to change the background colors and i want to block some controls which i am able to do in the main form - but i cannot refer to the subform.

Function PutValInMem()
Dim dbs As Database, rst As Recordset
Dim frm As Form, ctl As Control

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Table2", dbOpenDynaset)
Set frm = Forms![JP I]
On vnZ GoSub UDMemTbl
Set frm = Forms![JP I]![JP II] <---------'ERROR
On vnZ GoSub UDMemTbl
Else
Exit Function
End If
GoTo EndHere

UDMemTbl:
For Each ctl In frm.Controls
.... playing with controls in here
Next ctl
 
THANKS - I GOT IT FIGURED OUT

I was declaring it as the main form in the dim statement which is now

dim subfrm as subform

works well - thanks alot
 

Users who are viewing this thread

Back
Top Bottom