Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 05-19-2019, 05:19 AM   #31
Uncle Gizmo
Nifty Access Guy
 
Uncle Gizmo's Avatar
 
Join Date: Jul 2003
Location: Newbury Berks UK
Posts: 9,945
Thanks: 452
Thanked 881 Times in 837 Posts
Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough
Send a message via Skype™ to Uncle Gizmo
Re: How do you save logged in user ID for later use?

Quote:
Originally Posted by Tera View Post
So itís impossible to use custom properties because different users, use the same FE.
I have only loosely Followed the Thread so I may have the wrong end of the Stick - as usual! But it would seem to me that your only solution is to have a table in the back-end that records the permissions available for each user? Now when and wherever a user logs in, the permissions are automatically set from this table. In effect, they can login from any PC and when they do, they will always have the correct permissions.

__________________
Code:
                 |||||
               @(~‘^‘~)@
-------------oOo---U---oOo-------------
|                                     |
|      Uncle Gizmo              |
|                                     |
|                                     |
| Get $20 worth of "Nifty Code"       |
|      
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
| | Ooo | |_________________ooO____( )________| ( ) ) / \ ( (_/ \_)
Uncle Gizmo is offline   Reply With Quote
The Following User Says Thank You to Uncle Gizmo For This Useful Post:
Tera (05-19-2019)
Old 05-19-2019, 06:07 AM   #32
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,077
Thanks: 105
Thanked 2,444 Times in 2,246 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: How do you save logged in user ID for later use?

1. Database stats - as you have found out, some of the code works without the table tblSysObjectTypes but for full functionality you currently need the table as well. That may change when I update it.

2. User permissions - agree with the last two replies. Provided users login to your database, it is easy to set user permissions based on user name. Doing so means the permissions are not tied to a particular workstation
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
The Following User Says Thank You to isladogs For This Useful Post:
Tera (05-19-2019)
Old 05-19-2019, 04:43 PM   #33
Tera
Newly Registered User
 
Join Date: Feb 2019
Posts: 143
Thanks: 216
Thanked 7 Times in 7 Posts
Tera is on a distinguished road
Re: How do you save logged in user ID for later use?

Quote:
Originally Posted by Gasman View Post
No, I was thinking of updating the properties as they log in, or is that not possible, read only perhaps?

FWIW I used Tempvars when I had to do this. I thought of them as global variables, perhaps incorrectly.?
I have also used them when queries can be called by more that one form.?
I had the impression of once Custom Properties are set, they can not be changed afterwards. I have to take a look at them once again.

thanks for the hint.

Tera is offline   Reply With Quote
Old 05-19-2019, 04:51 PM   #34
Tera
Newly Registered User
 
Join Date: Feb 2019
Posts: 143
Thanks: 216
Thanked 7 Times in 7 Posts
Tera is on a distinguished road
Re: How do you save logged in user ID for later use?

Quote:
Originally Posted by Uncle Gizmo View Post
But it would seem to me that your only solution is to have a table in the back-end that records the permissions available for each user? Now when and wherever a user logs in, the permissions are automatically set from this table.
That is exactly what I am doing now. But the case is there are too many forms and too many permissions. So at login I can not set all the permission. I set logged in user ID and set the ribbon according to what he/she is allowed to do.

Then in each form's on-open event, I hide/disable some controls and set necessary permissions.

I was eager to know how real programmers like you and others do in this situation.

I appreciate your input.
Tera is offline   Reply With Quote
Old 05-20-2019, 08:12 AM   #35
Uncle Gizmo
Nifty Access Guy
 
Uncle Gizmo's Avatar
 
Join Date: Jul 2003
Location: Newbury Berks UK
Posts: 9,945
Thanks: 452
Thanked 881 Times in 837 Posts
Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough
Send a message via Skype™ to Uncle Gizmo
Re: How do you save logged in user ID for later use?

Quote:
Originally Posted by Tera View Post
But the case is there are too many forms
A common reason for there being a lot of forms is that you create a form and then, because you need to do something slightly different, you create a copy of it and modify it slightly. Now you have two forms. If you do this quite a bit, you can end up with 10 or 20 forms you don't actually need.

The alternative is to write VBA code which makes slight alterations to the form, this could be hiding or exposing particular controls, it could be providing it with a different record source, things like that.

Once you master this technique, you can significantly reduce the number of forms, and hence the headache!

Sent from my Pixel 3a using Tapatalk
__________________
Code:
                 |||||
               @(~‘^‘~)@
-------------oOo---U---oOo-------------
|                                     |
|      Uncle Gizmo              |
|                                     |
|                                     |
| Get $20 worth of "Nifty Code"       |
|      
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
| | Ooo | |_________________ooO____( )________| ( ) ) / \ ( (_/ \_)
Uncle Gizmo is offline   Reply With Quote
Old 05-20-2019, 08:29 AM   #36
Uncle Gizmo
Nifty Access Guy
 
Uncle Gizmo's Avatar
 
Join Date: Jul 2003
Location: Newbury Berks UK
Posts: 9,945
Thanks: 452
Thanked 881 Times in 837 Posts
Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough
Send a message via Skype™ to Uncle Gizmo
Re: How do you save logged in user ID for later use?

Quote:
Originally Posted by Tera View Post
in each form's on-open event, I hide/disable some controls and set necessary permissions.
There are two methods (I know of) you could employ which might simplify this process.

Instead of relying on the forms open event, add your own routines, (public functions) and call whichever routine is required when you open the form.

Every single control has a Tag property. You could add a flag or flags even, lots of different flags in the tag property of every control that needs hiding.

You could modify the public function I mentioned just now, and pass through into that public function the particular flag or flags that applied in this particular instance of opening, use the flag(s) to hide or unhide controls depending. I believe isiadog (Colin) has several examples of this method.

With Tags, instead of addressing each control independently, the routines or routines I mentioned above would have code especially written to inspect every single control in your form, look in the tag, identify if it has a particular flag and adjust the control accordingly.

The code if you are not familiar with this method of coding, then have a look for samples in the forum which contain the something like this:- For Each Control in Me.Controls


For Each Ctrl in Me.Controls

Where the me keyword represents the form the code is in.

Sent from my Pixel 3a using Tapatalk
__________________
Code:
                 |||||
               @(~‘^‘~)@
-------------oOo---U---oOo-------------
|                                     |
|      Uncle Gizmo              |
|                                     |
|                                     |
| Get $20 worth of "Nifty Code"       |
|      
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
| | Ooo | |_________________ooO____( )________| ( ) ) / \ ( (_/ \_)
Uncle Gizmo is offline   Reply With Quote
The Following User Says Thank You to Uncle Gizmo For This Useful Post:
Tera (05-20-2019)
Old 05-20-2019, 08:35 AM   #37
Uncle Gizmo
Nifty Access Guy
 
Uncle Gizmo's Avatar
 
Join Date: Jul 2003
Location: Newbury Berks UK
Posts: 9,945
Thanks: 452
Thanked 881 Times in 837 Posts
Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough
Send a message via Skype™ to Uncle Gizmo
Re: How do you save logged in user ID for later use?

Quote:
Originally Posted by Uncle Gizmo View Post

For Each Control in Me.Controls

For Each Ctrl in Me.Controls
More info on my website here:-

http://www.niftyaccess.com/loop-thro...t-of-controls/

Sent from my Pixel 3a using Tapatalk

__________________
Code:
                 |||||
               @(~‘^‘~)@
-------------oOo---U---oOo-------------
|                                     |
|      Uncle Gizmo              |
|                                     |
|                                     |
| Get $20 worth of "Nifty Code"       |
|      
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
| | Ooo | |_________________ooO____( )________| ( ) ) / \ ( (_/ \_)
Uncle Gizmo is offline   Reply With Quote
The Following User Says Thank You to Uncle Gizmo For This Useful Post:
Tera (05-20-2019)
Old 05-20-2019, 10:00 AM   #38
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,077
Thanks: 105
Thanked 2,444 Times in 2,246 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: How do you save logged in user ID for later use?

Tony (Uncle Gizmo) mentioned my examples based on using the tag property to show/hide or enable/disable groups of controls. You can find one such example at https://www.access-programmers.co.uk...d.php?t=293439
I use this idea in conjunction with user permissions and to manage various multipurpose forms. I find it a very useful approach which simplifies coding and reduces the number of database objects (as they can be reused in different ways.

BTW did you have time to look at the database stats utility properly today?
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
The Following User Says Thank You to isladogs For This Useful Post:
Tera (05-20-2019)
Old 05-20-2019, 10:52 AM   #39
Tera
Newly Registered User
 
Join Date: Feb 2019
Posts: 143
Thanks: 216
Thanked 7 Times in 7 Posts
Tera is on a distinguished road
Re: How do you save logged in user ID for later use?

Quote:
Originally Posted by isladogs View Post
Tony (Uncle Gizmo) mentioned my examples based on using the tag property to show/hide or enable/disable groups of controls. You can find one such example at https://www.access-programmers.co.uk...d.php?t=293439
I use this idea in conjunction with user permissions and to manage various multipurpose forms. I find it a very useful approach which simplifies coding and reduces the number of database objects (as they can be reused in different ways.
I have a copy of your sample database and at present I'm testing your method on my database .

Quote:
Originally Posted by isladogs View Post
BTW did you have time to look at the database stats utility properly today?
Sorry, I forgot to report the result. I tested it this morning as I promised. And it was OK.
Now it shows everything.
this is the result I received:

Database summary : 受注管理.accdb
===============================
Path : D:\Receiption\受注管理.accdb
File size = 74112 KB (72.4 MB)
Analysis completed on : 2019/05/21 3:48:52

Tables : 35
Fields : 1421
Records : 549836

Queries : 35

Forms : 164
Form Controls : 6783
Form Modules : 714

Reports : 50
Report Controls : 2615
Report Modules : 188

Macros : 11

Modules (Standard/Class) : 37
Module Procedures : 3336
Total Code Lines : 85461

Relationships : 1

Time taken : 26 seconds
===============================


thanks again.
Tera is offline   Reply With Quote
Old 05-20-2019, 12:13 PM   #40
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,077
Thanks: 105
Thanked 2,444 Times in 2,246 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: How do you save logged in user ID for later use?

Glad to have helped. I'll let you know when I update the database stats app.

Also do ask if you need any more info on the use of the tag property for managing groups of controls

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
The Following User Says Thank You to isladogs For This Useful Post:
Tera (05-20-2019)
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remember which User is logged in? wrightyrx7 Modules & VBA 7 09-12-2014 03:48 PM
User that is logged in Gunilla Forms 3 11-28-2010 11:33 AM
User who just logged in grnzbra General 3 08-31-2006 01:36 PM
user logged JonyBravo General 1 02-07-2006 02:30 PM
need help with logged on user I-1 General 3 10-28-2005 10:18 AM




All times are GMT -8. The time now is 05:02 AM.


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