Link to home
Start Free TrialLog in
Avatar of narv813
narv813

asked on

Set Permissions in Access

I want to set permissions inside of folders in a database (Access) so that only certain people can access them.  I have a Users Table and a Folder Table and then a concatenated table of Users/Folders that only has a User ID and Folder ID in it.   If a user indicates a folder name and a user's email address I want to be able to populate the Users/Folders table with the association.

The code I wrote for this was:

<cfquery datasource="datasource">
INSERT INTO Folder_Assignment(user_id, menu_item_id)
VALUES ('user_id', 'menu_item_id')
WHERE email_address = '#email_address#"
  AND folder_name = '#folder_name#'
</cfquery>

But it doesn't seem to work.  Am I totally off base with the way I'm doing this or am I close at all?  
Anyone have any thoughts?

Thanks,
Nancy
Avatar of Plucka
Plucka
Flag of Australia image

Hi narv813,

What's the problem your having, I think I understand what your trying to do, not sure how menu_item_id relates to the folders though?
Hi

With Insert Into - u wont be having where clause ...
its gotta be normal insert strait up ...
Something like this :

INSERT INTO Folder_Assignment(user_id, menu_item_id)
VALUES (<CFQueryParam CFSQLTYPE="CF_SQL_NUMERIC" VALUE="#User_ID#">,
<CFQueryParam CFSQLTYPE="CF_SQL_VARCHAR" VALUE="#Menu_Item_ID#">)

hth

K'Rgds
Anand
Avatar of mrichmon
mrichmon

Anandkp is correct in that you don't use a WHERE clause in an insert statement.  If you can explain why you thought you needed it we can probably help you write an if statement around the INSERT that will account for the conditions you were trying to test for or help you insert the correct information into your tables.
Avatar of narv813

ASKER

Maybe I'm just confused on how the database knows which user is being accessed.  I was using the WHERE clause to show which user I'm defining access for.  I want the command to go to the users table, get the user ID for the user that has the email address ____________ put that user ID in the concatenated table along with the folder id that they can access.  Does that explain it?  Or am I just confusing the issue more?
ASKER CERTIFIED SOLUTION
Avatar of mrichmon
mrichmon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial