473,320 Members | 1,926 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,320 software developers and data experts.

How to make an Access login with rights to user information

I want to create a login form for multiple users with different rights, and they can only see information in my queries and reports that pertain to them. For example: User1 logins in, on the switchboard I only want user1 to be able to see certain things. Then when user1 goes to see a report, it only shows user1, user1's information.

Now by what I have read and can gather, I will need a user table, and that table will have to have their username, password, and a rights level, but I have no idea how to put all of that into code in VBA to make it happen.
May 26 '10 #1
4 1686
fdfjc
8
Hi newbornman, here's how I've handled this. On my main form (or switchboard) I capture the user's login and enable/disable, show/hide the boxes, forms and buttons I want each to have access to.

Expand|Select|Wrap|Line Numbers
  1. Dim usernm As String
  2. usernm = Environ("USERNAME")
  3. 'Debug.Print usernm
  4. If (usernm = "JohnSmith" Or usernm = "JoeSmith") Then
  5.  
  6. Me.txtReadOnly.Visible = False
  7. Me.txtReadOnly.Enabled = False
  8. Me.txtRecursive.Visible = True
  9. Me.txtRecursive.Enabled = True
  10. Me.txtRecursive.SetFocus
  11. Me.AllowAdditions = True
  12. Me.AllowEdits = True
  13. Me.AllowDeletions = True
  14. Me.btnOpenEditLog.Visible = True
  15. Me.btnOpenEditLog.Enabled = True
May 26 '10 #2
Ok, so I need to take that code and put it into my VBA module, and then attach it to my login form? Does this make it to where one part of the company can only see their information? The reason I ask this, is because I am trying to make this for a company that has many parts.
For Example:
There are 8 companies. Company A, B, C, D, so on so forth.
There is one table with everyones information, and a whole bunch of queries and reports.
Company A logs on and goes to look at the reports. I want Company A to be able to only see Company A's information and not company B, or C or what anyone else.

If this code works then I apologize but like I said before I am new to this. Thanks for the help.
May 27 '10 #3
fdfjc
8
I guess part of it depends also on the version of Access you are using. 2007 no longer has user-level security, so this has been my work-around, but I am dealing with only a few users. You could take that table with everyone's names and assign a permission level to each. For instance

NAME PERMISSIONS
Pam Company A
Greg Company A
Sam Company B

So when username is Pam or Greg, you enable and make visible only Company A forms, buttons, text boxes, etc. And you can also the send value 'Company A' into a variable to be used as the where condition when you open those forms so that they only see Company A data. I could send you that code later if you would like to see it--I forgot my laptop and someone is bringing it to me soon.
May 27 '10 #4
Yes please for the code. As for everything else, thank you very much.
Jun 3 '10 #5

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

Similar topics

2
by: Sergio del Amo | last post by:
Hi, I implemented a Web-Site based in remote scripting with hidden frames. I am using Javascript to provide dynamic functionality. In the machine's local server works perfectly but when i uploaded...
1
by: Mike Ridley | last post by:
I have just inherited an Access Booking Application. Works fine, including some quite complex code that calculates an availability table from dates input by the user. I have produced a simple...
26
by: jamesbeswick | last post by:
I've been using Access since version 97 and I've migrated to 2003. I've noticed a substantial number of strange ActiveX/OLE and code corruption problems when writing databases. The only solution...
4
by: Ben | last post by:
Hi, i have some problem to access from code-behind a label nested into a CreateWizard control. I use a html-table for align purpose only. I try to change the text property of the label with...
1
by: jsd219 | last post by:
I have a fairly simple login in script and I need to make it have two levels of access not one. can anyone help me with this? The script is below: <?php // we must never forget to start the...
5
by: jasperz01 | last post by:
Hi, Is it possible using Office Automation to freeze panes in Excel from Access VBA code? I've been trying some things but can't get it right... Jasper
3
by: stumo | last post by:
Hi I'm fairly new to access and as such my experience of VBA is somewhat limited. I have a login form which is linked to an "employees table" which asks for users to enter their name and...
6
by: Fred Ho | last post by:
I have an access database, and want to make an login interface for (guest/staff/administarator). The guest should just able to use the form with buttons search/print only. The staff able to use the...
0
by: JFKJr | last post by:
I have an excel file, which has columns C and D grouped together, I am trying to delete blank columns and rows from the excel file, ungroup the columns and import the file to MS Access using Access...
4
anfetienne
by: anfetienne | last post by:
hi i have this code for login using a database <?php $username="********"; $password="********"; $database="auctionTemps";
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.