Kris
|
Posted: 01/27/2002, 12:19 AM |
|
I am registered user. Would greatly appreciate your help, if you could answer the following 2 questions.
I have a page with 4 forms. Search, tasklist, search1, tasklist1.
1) If the security is 3, then I want to display forms search and tasklist.
If the security is 2, then I want to display forms search1 and tasklist1.
2) Each user ID is tied to a company.
For users with security 2, I would like to get the company name from the company table and list records for that company in search1 and tasklist1. And when I add a record, add only for that company.
Thanks a million.
|
|
|
Nicole
|
Posted: 01/28/2002, 4:46 AM |
|
Krid,
1. refer to gotocode article "How to show/hide forms": http://www.gotocode.com/art.asp?art_id=54&
2. Add session variable UserRight as Input parameter for the grid form.
When you add the record use custom sql to restrict the company name list in a listbox.
|
|
|
Kris
|
Posted: 01/28/2002, 6:03 AM |
|
Nicole,
Where do I define the variable condition_to_hide and where do I check Session("UserRights")?
E.g. suppose form name is "Search" then
if condition_to_hide then
SetVar "FormSearch",""
exit sub
end if
|
|
|
Nicole
|
Posted: 01/28/2002, 6:09 AM |
|
Kris,
for "search" and "tasklist" forms use the following code in Open event of the form:
if Session("UserRights") <> 3 then
SetVar "Form<form_name>",""
exit sub
end if
for "search1" and "tasklist1" forms use the following code in Open event of the form:
if Session("UserRights") <> 2 then
SetVar "Form<form_name>",""
exit sub
end if
|
|
|
Kris
|
Posted: 01/28/2002, 6:15 PM |
|
Nicole,
Hide/Show form is working great. Thanks
One more favour...
To filter records for the user's companyID, I did the following in open form event to the companyID...
Session("CompanyID") = DLOOKUP("userlogin","company_id","emp_login="&ToSQL(sLogin, "Text"))
Now, where do I use this Session Variable to filter records from the main table for that company ID?
Also, How can i use this company as the default company , when you add a record?
Thanks again.
|
|
|
Inboy
|
Posted: 01/28/2002, 8:06 PM |
|
I assume you're working in ASP.
Here's how I would do it.
First, I would create seperate forms for the different tasks.
Then In go to form header and add code that looks something like this
<% if Session("USERRIGHTS") = "1" THEN %>
or to make it reletive
<% if Session("USERRIGHTS") > "1" THEN %>
and then go to the form footer and add
<% end if %>
This can be done with sessions, params, and could even let you program entire apps within a single file.
Just a thought.
|
|
|
Inboy
|
Posted: 01/28/2002, 8:06 PM |
|
I assume you're working in ASP.
Here's how I would do it.
First, I would create seperate forms for the different tasks.
Then In go to form header and add code that looks something like this
<% if Session("USERRIGHTS") = "1" THEN %>
or to make it reletive
<% if Session("USERRIGHTS") > "1" THEN %>
and then go to the form footer and add
<% end if %>
This can be done with sessions, params, and could even let you program entire apps within a single file.
Just a thought.
|
|
|
Nicole
|
Posted: 01/29/2002, 2:19 AM |
|
Kris,
to filter records from company table for company grid form add Input parameter CompanyID, assign it to company_id field, set type to Session.
Do you mean on Record from in company list you want to list only the companies of logged in user?
|
|
|
Kris
|
Posted: 01/31/2002, 8:04 AM |
|
Thanks Nicole.
Here is what I want to do.
After login, I want to get the companyID from login table for that user.
Display task records with search and grid forms. The task table includes companyID. So, I want to display the search and grid forms with the tasks for the company the user logged in. When the user add a record, add the task for that company in the task table.
Thanks for all your support.
|
|
|
|