473,513 Members | 2,669 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 3486
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
3487
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...
4
2174
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
2949
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...
35
2823
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...
21
6471
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...
4
2245
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"...
2
2618
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...
232
13066
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...
2
2552
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...
4
11311
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...
0
7257
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,...
0
7379
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,...
0
7535
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...
1
7098
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...
1
5084
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...
0
4745
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...
0
3232
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...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1591
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 ...

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.