473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Lock Form Controls based on a user ID lookup in a Table

I need a function to do the following when opening a Form named NewFrm_MainTemplate.

I need the function to look at the user id of the person attempting to open the form. Their Windows user ID will be in a Table we have named Tbl_Employee-----Field name is Employee_Win_User_ID

Also in the Table is a Filed named Main_Form_Rights This field contains 2 Values Administrator or View Only


What I need is to match the users Windows ID against Employee_Win_User_ID, thenm lookup in the field Main_Form_Rights.

If the value in Main_Form_Rights for that Windows User ID is View Only Then I need the following controls on the form NewFrm_MainTemplate locked

TxtCategory
cbo_Priority
Txt_InitialComments
cbo_WorkCategory
cbo_WorkType

If the value in Main_Form_Rights for that Windows User ID is Administrator Then I need the following controls on the form NewFrm_MainTemplate unlocked

TxtCategory
cbo_Priority
Txt_InitialComments
cbo_WorkCategory
cbo_WorkType

How can iput this in a module function so I can call this when opening the form?

Thanks
Sep 14 '06 #1
1 2494
PEB
1,418 Expert 1GB
Hi,

Expand|Select|Wrap|Line Numbers
  1. Function lock_form(is_admin) As boolean
  2.  
  3. If is_admin=True then
  4. Forms!NewFrm_MainTemplate!TxtCategory.Locked=false
  5. Forms!NewFrm_MainTemplate!cbo_Priority.Locked=false
  6. Forms!NewFrm_MainTemplate!Txt_InitialComments.Locked=false
  7. Forms!NewFrm_MainTemplate!cbo_WorkCategory.Locked=false
  8. Forms!NewFrm_MainTemplate!cbo_WorkType.Locked=false
  9. Else
  10. Forms!NewFrm_MainTemplate!TxtCategory.Locked=True
  11. Forms!NewFrm_MainTemplate!cbo_Priority.Locked=True
  12. Forms!NewFrm_MainTemplate!Txt_InitialComments.Locked=True
  13. Forms!NewFrm_MainTemplate!cbo_WorkCategory.Locked=True
  14. Forms!NewFrm_MainTemplate!cbo_WorkType.Locked=True
  15. end if
  16. end function
  17.  
  18. Have a nice day
  19. :)
  20.  
I need a function to do the following when opening a Form named NewFrm_MainTemplate.

I need the function to look at the user id of the person attempting to open the form. Their Windows user ID will be in a Table we have named Tbl_Employee-----Field name is Employee_Win_User_ID

Also in the Table is a Filed named Main_Form_Rights This field contains 2 Values Administrator or View Only


What I need is to match the users Windows ID against Employee_Win_User_ID, thenm lookup in the field Main_Form_Rights.

If the value in Main_Form_Rights for that Windows User ID is View Only Then I need the following controls on the form NewFrm_MainTemplate locked

TxtCategory
cbo_Priority
Txt_InitialComments
cbo_WorkCategory
cbo_WorkType

If the value in Main_Form_Rights for that Windows User ID is Administrator Then I need the following controls on the form NewFrm_MainTemplate unlocked

TxtCategory
cbo_Priority
Txt_InitialComments
cbo_WorkCategory
cbo_WorkType

How can iput this in a module function so I can call this when opening the form?

Thanks
Sep 16 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: John | last post by:
Just a general question... I'm currently using a combobox that when updated, opens a form with its recordset based on a query using the combo box value as the criteria. I'm I correct in...
3
by: Richard | last post by:
Hi, I have a form based on a table. When I filter the form I want to run a report based on the same table with the same filter as the form. No problem until I want to filter a combo box where...
5
by: CaliSchmuck | last post by:
I think this is probably simple, but I'm having a problem figuring it out. I have a form that is used to enter data. I want users to be able to enter a zip code in the form, and have the city...
7
by: Saintor | last post by:
What I do now is I put a value in the tag property, and using the form_current event, I run through all controls properties until the ones with the required tag value are met. Sound OK in theory,...
11
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
3
by: john | last post by:
In my form (table A) I have subform (table B (only 2 fieds: ID and App_name) where table A -Table B are linked 1XM. To be able to add a record in the subform I want to use a lookup form since the...
13
JodiPhillips
by: JodiPhillips | last post by:
G'day, I have a silly and simple problem that I need some guidance with. Due to the way our network is set up, I am unable to use the group permissions for Access and have had to implement log...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.