473,671 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBA code to Restrict Access to an access form

77 New Member
I am working on an access database wthat has a main form and other multiple forms. The main form has buttons that when clicked will take user to the respective forms. I want to restirct access to couple of forms so that only our admin will have access to it. Is it possible to do that using VB? Please help.

Thanks
Nov 24 '08 #1
1 3498
Dököll
2,364 Recognized Expert Top Contributor
Either VB or VBA should, I reckon you have something working already! Would you like to post it?

Provided your users are hitting a button to get to other forms, you'd need to have perhaps a password block.

I will add to VBA area for an idea, much later, will leave your post here though in VB for a closer look. But here's an excerpt of my code in a current MS Access form where a certain form needs a Password...

I won't post the whole thing, but you'll ge the point:

Expand|Select|Wrap|Line Numbers
  1.     Dim strPassword
  2.  
  3.     strPassword = InputBox("Please Enter Passcode", "Data Central Restricted Form")
  4.  
  5.     'Check to see if there is any entry made to input box, or if
  6.     'cancel button is pressed. If no entry made then exit sub.
  7.  
  8.     If strPassword = "" Or strPassword = Empty Then
  9.         MsgBox "No Input Provided; please enter passcode to continue...", vbInformation, "Data Central Required Data"
  10.         Me.Visible = False
  11.         DoCmd.OpenForm "DataData", acNormal
  12.         Exit Sub
  13.  
  14.     End If
  15.  
  16.     'If correct and part of passcode is entered open Passcode form
  17.     'If entire passcode is entered open RestrictedPsswrdForm form
  18.     'If incorrect passcode entered give message and exit sub
  19.  
  20.     If strPassword = "MyPassportPasscode" Then
  21.         DoCmd.OpenForm "Passwords", acNormal 'the form noone should get to
  22.     ElseIf strPassword = "MyPasswordPasscode" Then
  23.  
  24.     'send user elsewhere...
  25.  
  26.  
If this does not do, or you need anything further please stay tuned, and do post what you have thus far, for looks; seems to be a bit quicker for your posts to get real hits:-)

In a bit!
Nov 26 '08 #2

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

Similar topics

18
3501
by: Adrian B. | last post by:
Does anyone know of a framework or library that will enable me to use publish/subscribe comms? I want to create a server (using Python) running on a Unix box that will accept client connections (from GUIs built with wxPython) and publish realtime data updates to them. Any advice on where to start? Thanks. A.B.
4
2186
by: Vijay Kumar R Zanvar | last post by:
Greetings, Are the following inferences of mine correct? 1. #include <string.h> char *strcpy(char * restrict s1, const char * restrict s2); a. s1 != s2 b. That means,
5
2964
by: toddles666 | last post by:
Hi- Is there any way of restricting access to a database by application & account? For example, I only want the application APP1 to access the database using the USER1 account. I've tried to use the DB2 Governor to do this, but it seems it always allows the the first query to be processed before forcing the connection. Here is my db2gov config file: --- start config
35
2858
by: Michel Sanner | last post by:
Hello, One of the greatest feature of Python in my opinion is the way the interpreter can be used to integrate a wide variety of software packages by dynamically linking them. This approach has been extremely successful for us so far but now I run into a license nightmare. Some the libraries we wrapped using SWIG are under GPL but the applications we are distributing are not (mainly because
21
6503
by: Niu Xiao | last post by:
I see a lot of use in function declarations, such as size_t fread(void* restrict ptr, size_t size, size_t nobj, FILE* restrict fp); but what does the keyword 'restrict' mean? there is no definition found in K&R 2nd.
4
2252
by: awebguynow | last post by:
My Auth code works locally but not on my host, and I'm debugging it to find out, why not. Except where noted, I'll be referring to my webhost's configuration. I'm using a .htaccess "AddHandler" directive, to force php5 I notice with the help of phpinfo(), I'm locally using "Apache 2 Handler" but my host uses CGI. session.auto_start Off Off I'm actually hosting this alpha site, wholly contained in a subdirectory, but use relative...
2
2628
by: Frederick Gotham | last post by:
I'm going to be using an acronym a lot in this post: IINM = If I'm not mistaken Let's say we've got translation units which are going to be compiled to object files, and that these object files will be supplied to people to link with their own projects. Here's a sample function in one of the object files: void Func(int const *const p) {
232
13243
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first set of examples, after decoding the HTML FORM contents, merely verifies the text within a field to make sure it is a valid representation of an integer, without any junk thrown in, i.e. it must satisfy the regular expression: ^ *?+ *$ If the...
2
2562
by: phpnoob | last post by:
I have a php script that processes a form and then posts the user input to a data file on the server in a comma delimited format. For simplicity call the file "data.csv." The script is working well and the data is posted correctly to the data file. The big problem is that anyone can point their web browser to www.mywebsite.com/data/data.csv and see exactly what is contained in the data file. Obviously, I want the data in that file to...
4
11427
by: vinpkl | last post by:
hi i am working on admin section which has a login page with login id and pasword form. in my admin section i have many pages say like manage_products.php, description.php, user.php etc. if i have to access the manage_products.php page then i can access it just typing like the link below http://localhost/vineet/admin/manage_products.php without entering login user and pasword.
0
8473
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8911
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8597
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8667
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
7428
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
6222
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
4222
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...
0
4402
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1806
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.