Delete only 3 times

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a button linked to a query that will delete the max record in a table.
This is in case the data entry is incorrect and the information needs to be
replaced. Is there a way of making it so that this button can only be used
about 3 times. This is so that the supervisor can keep an eye on the number
of mistakes that are being made by his staff
 
One approach to accomplishing what you want to do might be to include a Date
field that automatically stores the current date when a new record is created
(default value - Date) and a "Yes/No" field in your table that holds the data
with a default value of "Yes". Your form would then be filtered to only show
those with the "Yes/No" field flagged as "Yes". When the user "deletes" the
record, you would simply flag the "Yes/No" field as "No". The you can
provide the supervisor with the ability to view all records that are flagged
as "No". The supervisor could then filter for the desired user and/or
specific dates.

This might provide a more flexable way to provide management with the tools
to actually manage the information and staff.
 
Three timed a day?
Three time every time the form is open?
Or
Three time until the supervisor decide to init the counter?
 
I think what I'm after is for the button to be used 3 times, then for a
message to come up and for it not to work until the supervisor has reset it.
 
You will need to create a new table, that keep the User_Id and the count of
Delete.

On the Onclick event of the button you can add a code that open this table
and check the number of delete, if the user is not found it will add it to
the table with count = 1, if it exist and equal 3 it wont let the use to
delete, other wise it will add 1 more to the count

Dim MyDB As Dao.DataBase, MyRec as Dao.Recordset
Set MyDb = CurrentDb
Set MyRec = MyDb.OpenRecordSet("Select * From TableName Where User_Id = " &
UserId )
If MyRec.Eof Then
MyRec.AddNew
MyRec![User_Id] = UserId
MyRec![CountOfDelete] = 1
MyRec.Update
Else
If MyRec![CountOfDelete] < 3 Then
MyRec.Edit
MyRec![CountOfDelete] = MyRec![CountOfDelete] + 1
MyRec.Update
Else
Msgbox "Three delete been done, please contact suprvisor"
Exit Sub
End If
End if
Enter here the delete code

' I hope this code will provide you with a starting point
 
Back
Top