Access World Forums

Access World Forums (
-   Modules & VBA (
-   -   [SOLVED] Storing Control properties in a table (

mjdemaris 09-30-2016 11:58 AM

Storing Control properties in a table
Hi all.

I am using one form to create new records as well as view existing records for review/editing.

I have all the controls disabled by default, and only enabled based on New Record, who is viewing the existing record, what the status of the record is and what department the users are in.

What I am trying to do is loop through each control to enable them based on these various criteria.

I have tried using multiple tags, such as 1, 2, 3, 4 so that I can loop through looking for a value of 1 or 2, etc., but if there are multiple tags, the control is skipped in the loop.

Then, I found this page: http://
in which one user suggests using a table to store control property data, but does not say exactly how.

Suggestions on how to get this to work?


Cronk 09-30-2016 12:25 PM

Re: Storing Control properties in a table
For those controls to be enabled, you could store the control name against the UserID, and not bother with tags.

Incidentally, you might be better putting users into groups rather than setting individual user permissions. I have used ViewOnly, EditData, Admin. You could have DeptAEdit, DeptAViewOnly, DeptANoAccess etc

missinglinq 09-30-2016 12:49 PM

Re: Storing Control properties in a table
To use multiple Tags, like this, you can use something like this, in an appropriate event:


Dim ctl As Control

For Each ctl In Me.Controls
 If InStr(ctl.Tag, "1") > 0 Then
  'Place code here formatting if Tag is 1
 End If
 If InStr(ctl.Tag, "2") > 0 Then
  'Place code here formatting if Tag is 2
 End If

Next ctl

Linq ;0)>

mjdemaris 09-30-2016 01:51 PM

Re: Storing Control properties in a table
Incidentally, I do have the users in groups (levels). But there remain situations where a low level user may or may not be able to edit the Order data - determined if that user is the creator of the order, and if the order has already been approved or ordered.

Also, the higher level users may edit some information if needed. However, all but one user must operate within their department. That one user oversees four departments.

Are you the "Missing Link" in the flesh? Does that mean our 'scientific' search of humanities development can come to an end? Or do we continue the struggle of creating skeletons out of partials and filling in the gaps with our imagination?

While in college, I read about this 'scientist' who said: I cannot accept the fact of Creation, because I cannot believe there is a God. ergo: Evolution is the truth, though we are missing solid evidence that leaves us without a doubt.

No offense intended to anyone, linq's name just sparked a small flame for debate...

mjdemaris 10-01-2016 09:16 AM

Re: Storing Control properties in a table
What do you mean by 'storing the control name against the UserID'?

mjdemaris 10-01-2016 02:44 PM

Re: Storing Control properties in a table
Well, I used a table to store the controls' name, and additional fields (y/n) to store whether that control should be enabled based on another variable.

So now i can log in as any user and click on the Edit button and only those controls are enabled.

All times are GMT -8. The time now is 07:33 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World