Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-30-2016, 11:58 AM   #1
mjdemaris
Working on it...
 
Join Date: Jul 2015
Location: Washington State, USA
Posts: 362
Thanks: 80
Thanked 7 Times in 7 Posts
mjdemaris is on a distinguished road
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://http://www.pcreview.co.uk/thr...perty.3150550/
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?

Thanks,
Mike

__________________
Life is not a problem to be solved, but a reality to experience.

Soren Kierkegaard
mjdemaris is offline   Reply With Quote
Old 09-30-2016, 12:25 PM   #2
Cronk
Newly Registered User
 
Join Date: Jul 2013
Posts: 2,152
Thanks: 3
Thanked 470 Times in 463 Posts
Cronk will become famous soon enough Cronk will become famous soon enough
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
Cronk is offline   Reply With Quote
Old 09-30-2016, 12:49 PM   #3
missinglinq
AWF VIP
 
missinglinq's Avatar
 
Join Date: Jun 2003
Location: Richmond (Virginia that is!)
Posts: 6,312
Thanks: 11
Thanked 719 Times in 669 Posts
missinglinq is a glorious beacon of light missinglinq is a glorious beacon of light missinglinq is a glorious beacon of light missinglinq is a glorious beacon of light missinglinq is a glorious beacon of light missinglinq is a glorious beacon of light
Re: Storing Control properties in a table

To use multiple Tags, like this, you can use something like this, in an appropriate event:

Code:
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)>

__________________
The Devil's in the Details!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


(All code solutions tested in Access 2003/2007, before posting, unless otherwise noted.)
missinglinq is offline   Reply With Quote
Old 09-30-2016, 01:51 PM   #4
mjdemaris
Working on it...
 
Join Date: Jul 2015
Location: Washington State, USA
Posts: 362
Thanks: 80
Thanked 7 Times in 7 Posts
mjdemaris is on a distinguished road
Re: Storing Control properties in a table

@Cronk:
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.

@linq:
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...
__________________
Life is not a problem to be solved, but a reality to experience.

Soren Kierkegaard

Last edited by mjdemaris; 09-30-2016 at 01:59 PM.
mjdemaris is offline   Reply With Quote
Old 10-01-2016, 09:16 AM   #5
mjdemaris
Working on it...
 
Join Date: Jul 2015
Location: Washington State, USA
Posts: 362
Thanks: 80
Thanked 7 Times in 7 Posts
mjdemaris is on a distinguished road
Re: Storing Control properties in a table

@Cronk:
What do you mean by 'storing the control name against the UserID'?
__________________
Life is not a problem to be solved, but a reality to experience.

Soren Kierkegaard
mjdemaris is offline   Reply With Quote
Old 10-01-2016, 02:44 PM   #6
mjdemaris
Working on it...
 
Join Date: Jul 2015
Location: Washington State, USA
Posts: 362
Thanks: 80
Thanked 7 Times in 7 Posts
mjdemaris is on a distinguished road
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.

__________________
Life is not a problem to be solved, but a reality to experience.

Soren Kierkegaard
mjdemaris is offline   Reply With Quote
Reply

Tags
control , loop , property

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
storing calculated control of a subform Wysy Forms 8 11-06-2015 01:29 PM
referencing control properties from within control event duug77 Forms 3 12-19-2011 04:24 PM
Table column name properties/Combo Box head properties Z34Lee General 5 12-08-2006 09:52 AM
Storing a calculated control.?? Durien512 Forms 4 01-03-2006 08:44 AM
[SOLVED] Using table values to control form properties. Darke Modules & VBA 3 05-01-2000 07:53 PM




All times are GMT -8. The time now is 12:43 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


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