I am trying to create a login for my database and I don't want to use the Microsoft way of doing so. I want to have the users login with a username and password then have that information verified in the "tblUsers" table.
UserID LoginID Level LevelID
jpurk jack23 admin 3
krimes kitty editor 2
lwalms low34 reader 1
I got as far as verifying the "UserID" and "LoginID" using dlookup
Nz(DLookup("[LoginID]", "tblUsers", "[UserID] = '" & Me.txtUserID & "'"), "")
=Me.txtPassword
The problem I have now is that I want certain items on the menu unavailable to users without the proper Level; If they are only an "editor" or a "reader", then I don't want them to have access to the "administrative" button where I have placed all admin forms.
After I use dLookup to verify the username and password, how do I now find out their "Level" and assign rights to different menu items? Thank you.
Assuming your DLookup has found an existing LoginID value, you can use another to retrieve that user's LevelID. Then enable/disable the administrative command button based on their LevelID.
I'll suggest something like this in Form Load:
Dim lngLevelID As Long
lngLevelID = DLookup("[LevelID]", "tblUsers", "[LoginID] = " & Me.txtLoginID)
Me.cmdAdmin.Enabled = (lngLevelID = 3)
Notes: That assumes you've previously loaded the user's LoginID number into a text box named txtLoginID. txtLoginID could be hidden if you don't want the users to see it. Or you can grab the LoginID value by some other method.
If you have one-to-one matches between Level and LevelID, you shouldn't need to store both values in tblUsers. You can create a UserLevels lookup table to hold both, and store just the LevelID in tblUsers as a foreign key to the appropriate row in UserLevels.
Finally, the strategy you're using can work, but the security is shaky. As "guidance" to users willing to follow the rules, it's OK. But it can be easily circumvented by even unsophisticated users. Look for a different approach if your security needs are stringent.
Related
TblEmployees has Fname, Lname and EmployeeName fields. EmployeeName should be Fname + Lname (i.e. John Doe). I want to enter Fname and Lname in a form FrmEmployeeData, and update TblEmployees with Fname, Lname and EmployeeName.
If FrmEmployeeData has as Data Source TblEmployees, how do I get the concatenated [Fname]&" "&[Lname] into the EmployeeName field of the table?
I also tried changing the DataSource of FrmEmployeeData to a query QryConcatenateFname&Lname where EmployeeName:[Fname]&" "&[Lname]. This gave the correct "John Doe" in the query result but I could not get it to update the TblEmployees.
What am I doing wrong? Thx.
It looks like you are learning access as this question is really too simple for stack overflow. Instead consult an Access book at your library or start finding Youtube vidoes and tutorials on the internet. Having said that here is a start:
Access gives you the ability to add a calculated field to a table in the design tab by treating it as a DataType. You can also add lookups and some data validation. Never do any of that!! Use forms to enter and search the data, and use reports to print the data.
A simple yet quite incomplete explanation is that as your database expands into multiple related tables you will find that entering the data directly into the tables is error prone for the database designer yet alone the clients. Because any observation will be distributed across multiple tables it becomes easier and easier to forget one or make a mistake as you add more and more tables.
Access is designed for quickly making simple forms for the tables in your database. If your relationships are already entered using the Relationships tool Access even generates starter forms that handle 1 to many relationships. Just click on a table and under home then forms group on the ribbon choose either form or form wizard and start playing with your new forms properties:
if you don't see the properties (hit f4 in most cases). Seriously every control has properties you can play with. In particular look at the control sources and for the form itself (hit the top left corner to select the form) check out the default view property.
I happened to include EmployeeName as a string in tblEmployees but there was no need other than having access put the EmployeeName textbox on the form. I would have to go back and delete EmployeeName from the table which is about the same effort as adding the textbox to the form myself. Below I show how to set the control source for EmployeeName to the usual FullName calculation
=[Fname] & " " & [Lname]
Access forms by default have both data entry and search capabilities. Play with the record selector highlighted at the bottom of the beautified form below. You can edit any record you see and the changes will appear in the table. If you go past the last record you can add a new record.
I've tried searching on here for my answer but have had no luck. I've tried many things to get this to work but haven't been successful so I thought I would post my question. I may repeat myself several times but I'm trying to be as specific/detailed as I can.
I have a form which has an append query to transfer all fields on the form into a table. On this form, I have an invisible control (textbox) which pulls the users Windows login ID and uses that as its default value. I have another field (textbox) for the user's full name.
I have ran a query to pull employee data from my tables to have the employee ID (same as their Window's login ID, first name, and last name. I have also ran an expression to concatenate the two name fields into one to show their full name.
What I've been trying to do is have it so that when someone opens up the form, their full name is already pre-loaded. As I stated above, this is pre-loaded based on a comparison of their Window's login ID with their employee ID that we have on record as they're the same. It's essentially Excel's version of vlookup() that I'm trying to do. I've tried dlookup() but was unsuccessful.
Does anyone know how to make the default value of the employee name control on the form to be determined by employee ID control which has its default value based on the user's Window login ID?
Example: Let's say that I have an employee called Fred Flintstone. In the database there's a table with fields for his first name and last name. There's also a field for his employee ID which is A111111.
When opening up the form, there's an invisible textbox control which has its default value derived from the Windows login ID that the employee used to sign onto the computer with. This Windows login ID happens to be A111111 which is the same as the employee's employee ID.
A query was created that has fields for the employee ID, First Name, Last Name, and an expression to concatenate the two name fields. So the first row would be: | A111111 | Fred | Flintstone | Fred Flintstone |. I don't know how to make tables on here yet so bear with me.
Going back to the form, there's a field for Employee Name. How would I get it to show Fred Flintstone as the default value upon opening the form?
Note: The employee name field will eventually be locked so that it cannot be changed by the employee. I don't know if that would have any impact but I thought that I would mention it.
In the onload event of your form (really rough code, will require some tweaking..):
dim db as dao.database
Dim rs as dao.recordset
Dim username as string
dim SQL as string
username = Environ("USERNAME") 'There are better ways to get username, but this is just a quick example.
SQL = "SELECT * FROM Your_Query WHERE username = '" & username & "'"
set db = currentdb
set rs = db.openrecordset(SQL,dbopensnapshot)
if rs.recordcount > 0
rs.movefirst
me.UserNameField = rs!username
else
msg "User Not Found"
End If
set rs = nothing
set db = nothing
I want to modify the webscript alfresco-remote-api-5.0.d.jar\alfresco\templates\webscripts\org\alfresco\repository\person\people.get.js. I need to display for the connected user only user he has created.
I have modify the filter to include username in query.
filter = filter + " AND cm:creator:admin";
people.getPeoplePaging(filter, paging, sortBy, sortAsc);
This must display only users created by admin.
But it's not working(no user is returned).
How can i select only users created by a certain user ?
By looking at below definition of content model I sure , what you want to achieve is not possible ,as person(user) does not have creator property.Below link shows the content model for users.
https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V4.2c/root/projects/repository/config/alfresco/model/contentModel.xml
https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V4.2c/root/projects/repository/config/alfresco/model/systemModel.xml
I have a requirement in Openbravo 3.0 framework . I have two user one is HR and the other is employee . Their is a checkbox in user window called HR USER .. In my window I need to write a read only logic so that when HR logins the record has to be editable , and when the employee logins the record has to be non editable,, I know how to do that for normal fields ,, But i am not getting anything about user validation..
In the employee screen i am assigning the user id to that employee.
Please Help
Read Only Logic based on Logged in User:
finding out the ID (primary key) of the User (HR or Employee) using PGAdmin Query tool.
Add read only as shown below.
Read Only Logic based on Logged in Role :
This can be achieved in three steps
creating Auxiliary Input.
finding out the ID (primary key) of the role (HR or Employee)
associating Read Only Logic to the Column.
First of all, we need to add an Auxiliary Input that will make
AD_ROLE_ID of the currently logged in user available to the user
window. Using the System Administrator role navigate to the
Application Dictionary || Setup || Auxiliary Input and create a new
record as shown below:
This will make the #AD_ROLE_ID session variable available to the [user] tab of the HR User window through the #ROLE_ID# variable.
Secondly, you need to find out what the AD_ROLE_ID of the HR role
is. Use the PgAdmin to query the AD_ROLE table and find that out. A
simple query reveals the following:
select ad_role_id, name from ad_role;
ad_role_id | name
----------------------------------+---------------------------
....
1000001 | Admin
SDJFALSDFJKLASJDFKLASDFASLDFJAKLSJ| velmurugan
SDFLAKSDJFLKASJDLFALSDFALDSKFJLAS | Employee
DSKLFJAKLDSJFKLASJFKLADSJFLKAJSDFK| F&B US, Inc. - Admin
....
(38 rows)
The primary key (AD_ROLE_ID) of the HR role is 054A32701D6D4CE6BF4F695DAB23EDB3. This will clearly be different in your case.
With this information, we can now find the HR User field definition
and set its Read Only Logic to
#ROLE_ID#!'054A32701D6D4CE6BF4F695DAB23EDB3' as shown below:
Hi i am new to filemaker, i am interested to learn and create an attendance system using filemaker. the way i like to do it is using the solution provided in filemaker ( Time Cards ). i would like my code to capture the timestamp of the user when ever the user enter his/her id and filemaker will automatically store the timestamp of that particular event. also the solution should be able to detect if it is already capture any previous time already entered by the same user. Sorry for my explaination. i hope its clear and understandable by you guys. Thanks in advance.
If the users are logging into the system (username and password), you can accomplish this by running a script on open (login).
That would work like:
go to tracking table (table made of timestamp and accountName field)
set error capture on
perform find - accountName = get(accountName)
if get(lastError) = 401 [this shows there are no records from this user], create new record, set field timestamp = get(currentTimestamp), set field accountName = get(accountName)
else [you can exit application, show dialog, or skip adding a new record if they entered previous data]
endif, then script whatever else you need to do onOpen.
If your users are entering in a temp field to log in against a user table, it's a similar step, you just need to grab $accountName as a variable to use in the find.