Modules & VBA :: Hide 5 Buttons Depending If User Has Permission Which Works Fine
May 14, 2014
i have the following code that hides 5 buttons depending if the user has permission which works fine.im trying to incorporate an IF statement if there is only 1 of the buttons visible then to automatically click the button. but if there is more than 1 do noting?
Code:
Private Sub Form_Open(Cancel As Integer)
Dim rsO As DAO.Recordset
Set rsO = CurrentDb.OpenRecordset("SELECT tblUserPermission.UserFK, tblUserPermission.CompanyFK, tblUserPermission.Permission " & _
"FROM tblUserPermission INNER JOIN tblUser ON tblUserPermission.UserFK = tblUser.UserPK " & _
"WHERE Username = '" & Me.txtName.Value & "'")
I would like to have 3 buttons on a form. When clicking Button1, Button2 and Button3 should be shown and Button1 hidden. When clicking Button3, Button2 and Button3 should be hidden and Button1 shown.
How can I do this when it is not possible to manage the object being clicked? I tried the following which did not work because of managing an object clicked is not allowed.
At this point, FE db has 4 linked tables, 3 are located in FileBE1, and the 4th is located in FileBE2.
The production BE is located on a server, the test (when working remotely) is on a local computer that is not able to connect to the server. Also, the test BE files (but not the table names) have different names than the production.
I have the idea of creating a table in the Front End that contains a list of users, filename and location (server or local drive).
Upon startup, how could I set up the vba to check the links and if they need to be changed will go and change them without the user having to click on link table manager or be prompted for names and path.
For now, I envision three rows in the table, one for the test user, one for local user and a default UNC for everyone else. (or would it be six rows since there are two files that need link checking and relinking).
I have built a end user form with multiple toggle buttons with "Yes/No" properties. I am wanting to link the buttons together, so if all have been selected/pressed it will read "pass" in a text box, but if even one is not selected it will read "fail". I was successful with the programming for one but not sure how to link them.
I was in the process of setting up a new user on our database, when I think I inadvertantly changed my own permissions. As the owner & creator of the database I am now unable to open it up - am getting th following messag:
"You do not have the necessary permissions to use the 'NDatabasesGAB Contacts.mdb' object. Have your system administrator or the person who creatd this objct establish the appropriat permissions for you."
After rading another thread on this subject I hav amendd the security options for the database, by right-clicking & selecting properties and the Security tab, then adding myself as the owner - but this has not resolved the problem.
Does anyone have any other suggestions to help me get back into my database?
Hi, I have put my database in a package using MS Access extension but the user and Group Perssion is not included to the package. Does some one know how to include the permissions too.
My db is secured using Access security but now find myself needing to code a little security work around if possible.
I have a form that has a subform. On the subform is a field named "Comments". The subform security only lets a particular group write to the fields it contains (including "Comments"). I have a new user that I need to allow to write to "Comments" but not to any of the other fields on the subform. I could make another subform with "Comments" only field and redo my security so that the original group can write to both subforms and new user can only write to "Comments" subform but I think it might be easier to code in that the new user is only allowed to write to field "Comments" in the existing subform. Every user logs into the db so I can get the user ID.
I am building a form in access and I am trying to find a way where user input isn't possible in the associated textbox when "No" from on option box is selected.
I am currently working o a Library Management System. most of the work is done but there remains two major problems.
I want to calculate the fines that a member will have automatically on a form. i have a basic pseudocose which is
IF Loan.returned=0 AND ReturnDate<Today{note- i.e. date()Today(), etc.} THEN Loan.fine_BDT=20*(Today-Loan.ReturnDate) Note2- The form has the following fields from a query which is connected to table loan- LoanID LoanDate ItemID MemberID ReturnDate DateReturned Returned(Yes/no)
2. The other one is with the Mail merge. i Want to use a query to supply the data for a mail merge. However, since the database id encrypted with a password it cannot be reached.
I'm looking to have either a combo box,, or 2 options buttons (whichever is easiest) that set a date field based on what is selected in the combo box/ option buttons.
The variables are 'Payment in 30 days" " Payment upfront"
if "payment in 30 days" is selected the date field on the form will enter the date as + 30 days from todays date if "payment upfront" is selected the field on the form will enter todays date.
This date field must be blank unless an option is selected, as this information is only entered in a later stage of the form.
I've tried a few different ways to enter this but i can't quite get it to work as i want.
I have created a simple login form that is based on User Name and Password.the table contains UserName, First Name, Last Name, Password and User Role(dev, admin...ect.)How can I change who can access different parts of the database?I want all the Development tools only accessable to People who have "dev" as a "User Role".Admin can only access the forms related to data entry and managers can view all forms but not the tables, querie and tools...ect.
I am trying to find a way to hide the close button on the ribbon. My 2007 and 2010 users keep closing the database by the "x" and it's driving me nuts. I have an exit on the switchboard. I tried to disable navigation and ribbons under options and it hides everything except the x. I tried the code:
Code: Docmd.Showtoolbar "Ribbon", acToolbarNo
In the startup form. Still doesn't give me what I want.
I would like to hide/unhide the navigation pane completely by using two buttons (pop the hood & close the hood) in a form. At this moment I used the following code:
Private Sub Command77_Click() DoCmd.SelectObject acTable, , True DoCmd.RunCommand acCmdWindowHide End Sub Private Sub Command78_Click() DoCmd.SelectObject acTable, , True End Sub
This however makes my form shut down and not my navigation pane.
I'm currently building a database in Access 2013. I've used Access many years ago, and not really in anger since maybe 2003, so I've been re-learning quite a lot. Here's an overview of my scenario, and issue:
The main purpose of my database is to allow engineers to log various bits of information when building, servicing and testing manufactured products for offshore exploration. Because some of the engineering team aren't so great with data entry etc, I've decided that, rather than deleting data, I'm going to use a 'deleted' flag: user clicks what he considers to be a delete button, but in reality an update query will simply update the flag and, because the form is built on a query which includes a 'where deleted = 0' filter, it'll no longer be shown. This will allow us more control over the data and will also allow me to check that everything is running okay.
My main forms include a number of subforms, including one which includes a second tier of nested form: Pin Maps for (electrical) Connectors.
What I need to achieve is fairly straightforward: as the user navigates around the form, I'd like a 'delete' button which is specific to that subform to become visible and for any other 'delete' buttons to become hidden. Once tested, the buttons would be 'stacked' in the same position at the top of the main form, so the user just thinks they're deleting the relevant record in the sub, or main, form.
Hi! I have a database and I have two groups of users: admins and users. The admins' switchboard is different than the users' switchboard. I cannot for the life of me figure out how to tell the db to open the admin switchboard if the admin logs in, or the user switchboard if the user logs in. Any suggestions? Is this even possible? I'm looking forward to your replies. Thanks!
I am looking for a way to customize fields to be hidden or not depending on user in forms or reports.
Any idea ?
I wanted to explore the customisation of each query but there must be an easier way to save personal parameters somehow so that the user would go through the forms and hide the non necessary fields once and we would then save somewhere these settings for each user.
I want to print different versions of a report depending on on the user login id "quserid" which I have on a login form "authorise".
As a simple example I have tried using a single user with the syntax shown below but get an error message "Object required". I suspect the problem is in the way I identidfied the quserid field. Can anyone please advise me on this. Regards Peter
If AUTHORISE.quserid = "ADMIN" Then Dim stDocName As String
I'm making database using access 2013 web apps. Name field in the table same with username in office 365. I want to make the user can only edit the field that have their name on there.
I got these three code routines for backing up an Access database file from two different forums. I installed them as is, on a test database, creating command buttons for each. The test database is not password protected. I intend (if I can get one of these working) to install it on simple, single file, password protected databases.The first two came from Access World Forums at: URL....
Code:
Function BACKUPS() On Error GoTo Err_BACKUPS Dim fso As Object Dim sSourcePath As String Dim sSourceFile As String Dim sBackupPath As String Dim sBackupFile As String
[code]....
I got a compile error "Invalid use of property." on the button sub. Then there was a simple On Click sub:
Code:
Private Sub Backup_Click() Dim fs Set fs = CreateObject("Scripting.FileSystemObject") fs.CopyFile CurrentProject.FullName, "C:", True Set fs = Nothing MsgBox "Database has been backed up successfully" End Sub Private Sub Command32_Click() End Sub
On this one I got a "Permission denied." error on the CopyFile method. As I said before, my database is not password protected.I found this third bit of code on another forum: URL...
Code: Public Function db_Backup() On Error GoTo db_Backup_Err
Dim sourceFile As String, destinationFile As String Dim aFSO As Variant Dim path As String, name As String
[code]....
On this one I got another "Permission denied." error on the CopyFile method. Again, my database is not password protected. This code had appeared to me to be the most promising of the three.
Hello I have a very important access database running on a Windows 98SE laptop with Access 97 on the laptop. I wish to have that database backep up and opened on an XP machine running Access 2003. The problem is that the laptop is a corporate laptop with lots of security features and the database can only be opened by that laptop. The laptop only has permissions to read the file, so cannot remove the protection. I have tried to copy the system.mdw file across to the xp machine (in the correct directory), but I still get the below error.
The current user account doesn't have permission to convert or enable this database.
To convert or enable a database, ensure the following: * You must join the workgroup that defines the user accounts used to access the database. * Your user account must have Open/Run and Open Exclusive permissions for the database object. * Your user account must have Modify Design or Administer permissions for all the tables in the database, or it must be the owner of all tables in the database. * Your user account must have Read Design permission for all objects in the database. * Request that other users close the database.
I have tried to create a new database on the xp machine and import all the data into a new database, but again I get an error (but only when importing certain forms and macros) below:
"You don't have permission to import, export or link to 'item name'"
I have also tried to create a blank database and import data from the database into it on the laptop, with the same error message above.
Does anybody have any ideas about this one? For example is there a piece of software to remove the protection (not a password remover)? - help appreciated.