Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 How to detect whether a control has a property

Author  Topic 

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-05-16 : 22:29:31
I've noticed a problem where if I pass a control to a function (as a parameter), Access does not always provide the correct properties collection for the control.

For example, if I iterate through the properties collection of the control to find out whether it has a .enabled property, sometimes the collection does not contain the property although the control definitely has the property.

Last resort is to try to refer to the property and use On Error to track if Access bails - but it would be much nicer if I could iterate the REAL properties collection rather than some default list which access appears to provide.

Any ideas?

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-05-17 : 00:50:19
I think this problem does not occur in VB6. Did you try it in VB6?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-05-17 : 00:53:00
Madhivanan

I'm using Access VBA and Access forms. Not VB6.

I apologise if I was not clear enough

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

Hyukevain
Yak Posting Veteran

66 Posts

Posted - 2005-05-28 : 14:51:14
It happen to me either.
For example, I have datagrid control named Dg1 and if I want to iterate all its property, I only can have some of them.
My solution is :
Declare 1 object as datagrid (Dim x as DataGrid), when I iterate the x variable, it will show all datagrid property, then when the code finish, I'll change all x variables with my datagrid name (Dg1).
So far it works for me.
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-05-29 : 19:29:35
Good thinking - I like it!

Thanks for the tip.

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -