473,811 Members | 3,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

4 New Member
I need a function to do the following when opening a Form named NewFrm_MainTemp late.

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_Us er_ID

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


What I need is to match the users Windows ID against Employee_Win_Us er_ID, thenm lookup in the field Main_Form_Right s.

If the value in Main_Form_Right s for that Windows User ID is View Only Then I need the following controls on the form NewFrm_MainTemp late locked

TxtCategory
cbo_Priority
Txt_InitialComm ents
cbo_WorkCategor y
cbo_WorkType

If the value in Main_Form_Right s for that Windows User ID is Administrator Then I need the following controls on the form NewFrm_MainTemp late unlocked

TxtCategory
cbo_Priority
Txt_InitialComm ents
cbo_WorkCategor y
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 2511
PEB
1,418 Recognized Expert Top Contributor
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_MainTemp late.

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_Us er_ID

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


What I need is to match the users Windows ID against Employee_Win_Us er_ID, thenm lookup in the field Main_Form_Right s.

If the value in Main_Form_Right s for that Windows User ID is View Only Then I need the following controls on the form NewFrm_MainTemp late locked

TxtCategory
cbo_Priority
Txt_InitialComm ents
cbo_WorkCategor y
cbo_WorkType

If the value in Main_Form_Right s for that Windows User ID is Administrator Then I need the following controls on the form NewFrm_MainTemp late unlocked

TxtCategory
cbo_Priority
Txt_InitialComm ents
cbo_WorkCategor y
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
3279
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 thinking that using: docmd.openfrm "frmName",,,where "=" & cboSelectID will open all records and then just navigate to that filtered record, which is not as fast/efficient as using a query where the criteria is
3
6618
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 the text value is on a different table. The me.filter is then a text instead of the id-number from the lookup table. This causes the report to prompt for the parameter. How do I get by this problem? Do I need to create a temporary table? I rather...
5
2889
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 and state come up automatically. I have two tables: Table 1 (14 fields): Customer Name, Address, City, State, Zip,
7
9834
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, but it is ... slow. I thought having a table with the name, type of controls and put my 'tag value' there. At the opening of the form, I would retrieve a recordset from the table, and perform a subroutine on the current event to lock/unlock...
11
3488
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 click a button to determine whether the zip code is unique. If the zip code is not unique, another form/dialog is displayed (fclsLookup) - lookup form/dialog. The zip code and zipid are both passed to the lookup form/dialog by reference. I...
8
4417
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 click a button to determine whether the zip code is unique. If the zip code is not unique, another form/dialog is displayed (fclsLookup) - lookup form/dialog. The zip code is passed to the lookup form/dialog by reference. I then load a...
4
3524
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 click a button on a pop-up window the javascript for that button click does a 'button.form.submit'. On the Server side there is a Button click event for this button, but for some reason it no longer fires. It worked fine before and everything...
3
5355
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 number of possible values is over 300. For data consistancy I've locked the subform so that the user can't add or change values manually without using the lookup form. My question is: What's the best way of adding the record to table B which the...
13
3264
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 in procedures via a log in table within the database. This works fine. I have now expanded this table to include further data about the authorised user – Power User, Team Leader, & Facilitator. Depending on the user’s status as to which one of...
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.