473,473 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Selective blocking of Inserts and Updates

4 New Member
Not sure if the subject makes sense, but it was the best I could think of.

We have a Table that contains a schedule. The schedule has certain pieces of information that are required to be updated by certain members of the organization, specifically Shift, Start Date, and Line. Each record also has a column for the customer that it is for.

I have built a cross reference table that contains the customer and the NT User that is responsible for that customer, example domainname\johndoe

What we would like to do is block domainname\johndoe from being able to update or insert on any of the records that he is not responsible for.

So if he attempts to change the shift for example, it denies the change and possible pops up an error indicating that the change was blocked because he is not the responsible party.

Input in this is through a query which views the table data in MS Access. It cannot be moved to a Form without some serious redesign, so I cannot put the block in there. I assumed that this could be blocked with a Trigger that checks the customer column, checks the crossreference and then either allows or denies the update.

So is this a viable idea, or should I explore the move to an input form and make the change there in MS Access via VBA.
Nov 27 '07 #1
3 1403
ck9663
2,878 Recognized Expert Specialist
The answer to your question is, Yes. That would be one way of doing it.

Can you try to modify the "query which views the table data in MS Access" to retrieve only data for the specific user by adding "WHERE table.UserResponsible = system_user' ?

--CK
Nov 27 '07 #2
rpk740
4 New Member
The answer to your question is, Yes. That would be one way of doing it.

Can you try to modify the "query which views the table data in MS Access" to retrieve only data for the specific user by adding "WHERE table.UserResponsible = system_user' ?

--CK
The problem with that approach is that we need the full schedule to be visible that way changes can be made with visibility to other records that have been changed.

If I limit the schedule to just those records that I am responsible for, and I want to change a date, I would not be able to see that someone already has that date booked since it would not show on my schedule.

It is not an issue that the same date could be booked, since the schedule still requires that the planners review it and make the necessary adjustments. But full visibility is the idea.

At first we started with just an audit trail, but I started to think that the audit trail would be needed only for records that should be allowed to be changed
and that we should deny changes to those who are not allowed to make them.

Below is the audit trail trigger, I figure that the change should occur somewhere
within that first IF statement, or make the first IF the second, and the first should be the permission check.

This is for SQL 2000 SP4/Windows 2000 SP4

Expand|Select|Wrap|Line Numbers
  1. CREATE TRIGGER audit_mschange
  2. ON dbo.T_PP_Table_2 
  3. FOR update AS
  4.     IF (UPDATE([Start Dt]) OR Update(shift) or Update
  5. (comments) 
  6.     or Update(status) or Update (line))
  7.          BEGIN
  8.  
  9.           INSERT INTO T_MS_RB_AUDIT
  10.  
  11. (ord_no,line_tank_old,line_tank_new,shift_old,shift_new,comments_old,comments_new,status_old,status_new,trx_dt,trx_username,
  12. start_dt_old,start_dt_new)
  13.  
  14.            SELECT ins.[PP Ord No],
  15.                 del.line,ins.line,
  16.             del.shift,ins.shift,
  17.             del.comments,ins.comments,
  18.                 del.status, ins.status,
  19.                   getdate(),
  20.             suser_sname(suser_sid()),
  21.         del.[Start Dt],
  22.         ins.[Start Dt]
  23.          FROM inserted ins, deleted del
  24.          WHERE ins.[PP Ord No]=del.[PP Ord No] AND
  25.                ins.autonumber=del.autonumber AND
  26.             (ins.status <> del.status OR ins.[Start Dt] <>
  27. del.[Start Dt] or ins.status <> del.status
  28. or ins.comments <> del.comments or ins.line <>
  29. del.line )
  30. END
  31.  
Nov 27 '07 #3
ck9663
2,878 Recognized Expert Specialist
The problem with that approach is that we need the full schedule to be visible that way changes can be made with visibility to other records that have been changed.

If I limit the schedule to just those records that I am responsible for, and I want to change a date, I would not be able to see that someone already has that date booked since it would not show on my schedule.

It is not an issue that the same date could be booked, since the schedule still requires that the planners review it and make the necessary adjustments. But full visibility is the idea.

At first we started with just an audit trail, but I started to think that the audit trail would be needed only for records that should be allowed to be changed
and that we should deny changes to those who are not allowed to make them.

Below is the audit trail trigger, I figure that the change should occur somewhere
within that first IF statement, or make the first IF the second, and the first should be the permission check.

This is for SQL 2000 SP4/Windows 2000 SP4

Expand|Select|Wrap|Line Numbers
  1. CREATE TRIGGER audit_mschange
  2. ON dbo.T_PP_Table_2 
  3. FOR update AS
  4.     IF (UPDATE([Start Dt]) OR Update(shift) or Update
  5. (comments) 
  6.     or Update(status) or Update (line))
  7.          BEGIN
  8.  
  9.           INSERT INTO T_MS_RB_AUDIT
  10.  
  11. (ord_no,line_tank_old,line_tank_new,shift_old,shift_new,comments_old,comments_new,status_old,status_new,trx_dt,trx_username,
  12. start_dt_old,start_dt_new)
  13.  
  14.            SELECT ins.[PP Ord No],
  15.                 del.line,ins.line,
  16.             del.shift,ins.shift,
  17.             del.comments,ins.comments,
  18.                 del.status, ins.status,
  19.                   getdate(),
  20.             suser_sname(suser_sid()),
  21.         del.[Start Dt],
  22.         ins.[Start Dt]
  23.          FROM inserted ins, deleted del
  24.          WHERE ins.[PP Ord No]=del.[PP Ord No] AND
  25.                ins.autonumber=del.autonumber AND
  26.             (ins.status <> del.status OR ins.[Start Dt] <>
  27. del.[Start Dt] or ins.status <> del.status
  28. or ins.comments <> del.comments or ins.line <>
  29. del.line )
  30. END
  31.  
i guess the trigger will be your choice. specially if this table can be modified in SQL Analyzer and similar tools. if the only way to access the table is through your GUI, i'd still recommend to pass the burden on the front-end and not at the back-end.

try adding a flag on the view that signify if the record is read-only or read-write mode. once clicked, your GUI checks if the user can actually edit the record or not. if not, prompt for a dialog box. if he can, proceed to edit mode...
Nov 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Edward | last post by:
SQL Server 2000 Enterprise Edition Access 2000 Front End One of our clients has recently been experiencing problems with an app that has run satisfactorily (though slowly) for some time. To...
1
by: Hal | last post by:
SQL2K, sp3 Active Server Pages front-end I am having a blocking problem with a spid executing a stored procedure that does no updates. When I look at the locks the blocking spid has, some of...
1
by: Hal | last post by:
I am experiencing blocking problems on SQL Server 2000, SP3a. I have read the posts and set up a job SQL agent to report on these occurences I save the results to a table before executing an sp to...
3
by: Viswanatha Thalakola | last post by:
Hello, Can someone point me to getting the total number of inserts and updates on a table over a period of time? I just want to measure the insert and update activity on the tables. Thanks....
0
by: Mike Connor | last post by:
I am having trouble getting Conditional Folder creation & File insertion to work using VS .Net in a Deployment Project for a C# app. I am displaying a generic Textbox Dialog under the User...
1
by: Craig Stadler | last post by:
Using mysql 4.0.23- What is the best way to execute several (hundreds of) inserts and updates? Rather than issuing tons of individual inserts and updates, can I send the strings to a text file...
23
by: David McCulloch | last post by:
QUESTION-1: How can I detect if Norton Internet Security is blocking pop-ups? QUESTION-2a: How could I know if a particular JavaScript function has been declared? QUESTION-2b: How could I...
0
by: Eric Paul | last post by:
I have been in search of a better way to handle bulk inserts and updates into SQL 2000 using c# and while I have found a few different ways to accomplish this I was wondering what is considered to...
0
by: Benzine | last post by:
I recently rolled out replication on our production server (MS SQL 2000 SP4) and every time a subscriber tries to sync the following always appears in the Merge Agent History: "Downloaded 100...
4
by: shreyask | last post by:
I have been working on doing bulk updates and inserts through sqlapi++ using a bulk udpate extention library, developed, a long time ago, internally. The database is oracle. The bulk inserts/updates...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.