Modules & VBA :: How To Define Accessibility For Different Users
Oct 28, 2014
I have a multi-user database. I would like based on the logged-in user, some buttons and controls in different forms be disabled and the others be enabled.
There is a login form that gets the username; I made also a function to define authorities for users in it.
My plan is that when user enters to the database, on load of the main menu the function calls and disables the defined controls in different forms. I tried to use this kind of codes:
Function User_1()
[Forms]![frmMainMenu].[cmdUpdateDatabase].Enabled = False
[Forms]![frmChooseReports]![cmdOrdersFollowUpReports].Enabled = False
End Function
Function User_2()
[Forms]![frmMainMenu].[cmdChooseCharts].Enabled = False
End Function
But this code only works for the forms that are opened at the moment and if one of them is closed the system gives Error.
I have one color scheme I want to use all through the database I am developing. The next examples have just one color defined, to make it simpler (a dark blue, that I would call B1)
Code: private sub setlabel() Dim B1 B1 = RGB (0,52,105) me.label1.forecolor = B1 end sub
... however this means I have to repeat the color definition every sub, so I thought would be neater to define a function to set my color codes (I have 20 colors).
Code:
Function SetColor() Dim B1 B1 = RGB (0,52,105) End function
My objective, is when I'm working in forms, Iwould (ideally) call this function "setcolor" and just write my code for the blue. I tried the examples below:
Code: Private sub setlabel() SetColor() me.label1.forecolor = B1 end sub
[code]...
Again, this is probably some definition of arguments or dimensions that I am not aware oh. How to predefine the colors in a function to give them a "short" code which I can call in any sub in the database?
This table holds variables that I want to declare to use throughout my application. I have been told in another thread that tempVars are the best way to do this.
I have written the following code, which works on a limited basis:
Private Sub btnSetVAr_click() TempVars.Add "udvVar", Me!My_value.Value End Sub
This defines a single variable on each button press, fine to work out how the code works, but not much use. What I really need to do is when the initial menu screen loads to call a routine to assign all the variables stored in the table using a loop to do this. The idea is to make all variables values easy to edit or add to, rather than have to edit code each time we need to change them.
The variables table holds 14 records so far, such as:
My_Var, My_Value
EuroRate, 0.885 ConDisc, 0.9 MollDisc, 0.8
As well as holding numbers, they hold strings and date values.
So, on loading the initial form, use an event to assign the variables from the table using the tempVar name as the value held in "My_Var" and it's value as held in "My_Value"
I'm in the middle of developing a database for our engineering group to track projects. I've got a question:
I'm using Runtime because none of our group has MS Access loaded on their system. So, I'm providing a link to the participant to download the free Runtime Software and providing a Shortcut to the database in the shared area.
My question is, when I split the database and provide the users with the front end do they still require runtime? Do I still provide them the link to download the free Runtime software and if so, do I save both the back and front end with the .accdr extension? I'm assuming that since they will have the front end on their systems individually they will no longer require the Shortcut.
The way the system is currently, it seems that only one user is permitted in the database at a time as it is locked out. I would like for more than one user to be able to access the database at a time. I've set the Default Open Mode to Shared so I'm not sure why it gets locked down when a user is accessing it.
I am trying to define a path to identify a current folder - I'll try and explain the way the following code works first (and it does work 100%)
The following code identifies folders and sub-folder structures and imports them (their structures and folder paths and filenames) into a DB
It also simultaneously retrieve's any xml docs within those respective folders and imports the XML data into the same database ........ and then moves those folders into a "processing folder" location.
Cool yes, but I can only import the XML doc's at the moment, by hard coding the path (like this):-
I would like to declare Global or Public variables from a table so they can be added to or edited easily. I had the following function to do this with Alpha Five but at the moment my lack of knowledge of Access VBA is making this task difficult.
Here is the function that I use in Alpha:
FUNCTION udVars AS A (udTabName AS C ) dim codeStr as c t=table.open_session(udTabName,file_ro_shared) t.fetch_first() while .not. t.fetch_eof()
[Code] ....
It opens a table reads in the records and then makes them into a string the string would look something like this:
"Public EuroRate as Single = 0.885"
I would then need to use this string to declare the variables but not sure what command to use - I was looking at the Eval function last night but couldn't get this to work...
The table would hold strings for all the above so you would have:
My_Var (variable name) My_Typ (type of variable e.g. Single) My_Val (value e.g. 0.885)
The table would hold as many variables as required, some would be dates, some paths for making directories and some would be numbers.
Is it possible (and how...) to declare a module-specific form variable (or any variable for that matter) at the top of said module, so it doesn't need to be set at the start of each subsequent procedure?
I have a module of code specific to one form with a number of procedures, each one of which requires me to Dim / Set the form variable. It would be much neater if I could do it once at the start.
Code: Option Compare Database Option Explicit Public Sub Populate(lngParameter As Long)Dim frm As Form
I have two tables. The first is a list of users. The second is a list of projects. I need to loop through the user list and assign each one to a project. At the end of the user list it will just start over at the top until all the projects have someone assigned to it. What is the best way to do this?
Table1 Users
User1 User2 User3
Assignments
ProjectAssigned To Project1 Project2 Project3 Project4 Project5 Project6
After processing.
ProjectAssigned To Project1User1 Project2User2 Project3User3 Project4User1 Project5User2 Project6User3
I know this is possible (e.g. opendatasource) but search as I might I can't get the exact code.
Scenario: Multiple front ends, in different folders, linked to single back end.
When mail merging, a temp table is created in FE - thereby different source for each user.
The Word doct is linked to a source (via Mail Merge) and I want to change that source according to the logon of the user, which is held on an open form.
Ideally like: Case Mary use C: Db1 emptable Case Tom use C:Db2 emptable
I'm wondering if there's any way to find out who has a database open.
I've saved the file as an ACCDE for the users and kept the ACCDB file as my working file. Whenever I make changes to the db I need to save a new ACCDE file on top of the existing one. In order to do that, I need to ensure no one has the db open. Half the time I need to track down 1 of 15 people to find out who it is that has it open so I can kick them out and save.
I don't have any login features, but could use the POD # that each cubicle has associated to their computer if Access allows that...
I have created a module, where based on various selections (form), the output is thrown in the table for editing various fields. This works fine with single user. But once I have placed the same database on the share drive for multiple users, the users are unable see the data in the text filters. I don't know what is the issue all about. Also if i use me.requery, the text filters becomes blank. Below is the code :
Code: Option Compare Database Option Explicit Public Function SelRec(shDate As Date, ATMID As String, City As String, Depots As String, Vendor As String) As Boolean SelRec = False
I need to separate Users and admin on login so that the admin can go to admin form and users to specific form using vba access. Here is my login code
Private Sub cmdLogin_Click() 'Check to see if data is entered into the password box If IsNull(Me.cboUserName) Or Me.cboUserName = "" Then MsgBox "You must enter a Password.", vbOKOnly, "Required Data" Me.cboUserName.SetFocus
I need to make sure that all users on the network can access a specific network drive folder.
Most users don't have a problem but some users have the network drive mapped differently so when running the feature required their system can't find the file at that specified location.
I have the location of the files hard wired into the VBA code.
E.g. Z:INVDATACOMPANIESCompanyAASSETS Pty LtdPrecedents 2015STAGE 3A - COLLS-DEMS
The location is outside of the project address.
I need to be able to make sure the address of the folder is the same for all users.
I have been searching for info with users & permission levels. I have ready a lot about ULS (User Level Security) which doesnt seem to be my answer as I do not have admin rights and I believe it is not suitable with Access 2010.
Basically I have an 2010 Access database which is used by my department as a project management tool. It has various tables, forms, queries & reports, I have created a table with user names & passwords and a login form. So when the databases opens the login form is launched & the users selects their user name & enters their password, then the main menu is shown.
Everything works really well, but as the moment there is no difference between all the users. All I want to do is to be able to make one of the Logins read only, ie if the Reviewer is logged in they can see & read every form and run every report but they can not make any edits.
I have some code that when a check box in a table is ticked, sends a pop up message to the users logged in (message is on a hidden form), then it closes the DB after a pre-dtermined period of time.
The problem I'm having is that we are a large site with a about 25 differnet servers that our users log onto via Citrix, when a user is on a different server it isn't displaying the message nor closing the DB down.
trying to achieve this? Or is there a better way to see who is logged in and get a message to them?
I'm using Access 2003 btw
Code I'm using below
Code: Option Compare Database Private Sub Form_Load() Me.TimerIntderval = 10000 ' change to 300000 for about 5 minutes End Sub Private Sub Form_Timer() DoCmd.Close Application.Quit End Sub
We have a database that is split. Every user has their own front end (installed via a .bat file so that the users always have a local copy of the most recent version), linked to a shared back end on a server. This seems stable and functional for us so far.
However, because our users are geographically separated, I don't actually know how many folks are using the database. I know the folks who contact me, but everyone in our company could use it if they wanted to.
For requesting funding, guiding future development, etc., I need to get some metrics:
Total number of unique users Avg uses per day
Total number of simultaneous users (daily, weekly, and monthly maxes and mins)
What is the best way to get this info? Write user info and a timestamp to a table each time a front end is launched? Are there tools for monitoring this sort of information?
I have created a ribbon for the users on all forms, and named that ribbon on each form. While I can bypass the Main ribbon (hiding backstage and most other tabs) by holding the shift key on open, the minute I open a form I am stuck with the very limited form ribbon I've named. Is there a programmatic way I can ignore this call, either when holding the shift key or some other avenue?
My database is used by a few users on a shared drive in "read-only" mode so they can't change any data.I set a scheduled task to copy an updated version of the database (which I edit) every morning.
The problem is that when the users forget to close the database file I can't overwrite it.For this purpose I wrote a small code that quits the application at 00:00 using Application.Quit.The code WORKS when I test it on my computer, but every morning when I try to open the file I see that it is opened by another user since I also open it as "read-only" - meaning the code didn't work...getting the code to work properly OR get a better solution to be able to overwrite the file even though it's opened by other users.
I've been using Access 2007 to run queries on a database where we eventually export results as separate Excel spreadsheets for individual clients. The process is quite involved, using queries to change fields from code letters to words and splitting the database up into different client tables, saving the tables under date order and with different client codes.
I now need to pass this role on to colleagues, so need to make everything as straightforward as possible.
I had thought to use a Form as the user interface, with a minimum number of buttons, however I need either the system or the user to amend the date for the initial table, then to use this new table and run a series of standard queries on it, then produce the separate tables.
I don't think I can just use macros behind the buttons, because the database name is changing each time.
I assume some parts will be too tricky to automate - it will be necessary for colleagues to follow instructions instead.....
Hi, all... :) I need to create cascade relationship on fly. I've succeeded to create the relationship by: ALTER TABLE tName ADD CONSTRAINT fk_id FOREIGN KEY(ID) REFERENCES tPrimary(ID) and even succeeded to check the referential integrity by: ALTER TABLE tName ADD CONSTRAINT fk_id FOREIGN KEY(ID) REFERENCES tPrimary(ID) CASCADE
The real problem comes when i am trying to enforce the cascades. I do not find any expression doing it.
the standarts of sql: on update cascade or of sql server: on update cascade go just don't work in access :(
My Access application consists of two MDB files: the application file and the database file. The application file has links to tables from the database file. Now, I want to define relationships to optimize my database performance. Where should I define them? In the database file? In the application file? Both?
I have a table with x columns. In a form I can choose 4 different columns to define my search. Now, I have this SQL-statement, that strangely doesn't work. Can someone help me with this?
SELECT a.Nr, a.Objekt, a.Applikation, a.Modul, a.Datum, a.Anmalare, a.Onskemal, a.Klart, a.Prio, a.Status, a.Ansvarig FROM tblArenden AS a WHERE ((IIf(Not IsNull(Forms!frmFiltrera!cboObjekt),a.Objekt Like Forms!frmFiltrera!cboObjekt & "*","*"))<>False) And ((IIf(Not IsNull(Forms!frmFiltrera!cboApplikation),a.Applika tion Like Forms!frmFiltrera!cboApplikation & "*","*"))<>False) And ((IIf(Not IsNull(Forms!frmFiltrera!Prio),a.Prio Like Forms!frmFiltrera!Prio & "*","*"))<>False);