Trying to stop people changing data once entered

marmaladecoops

New member
Local time
Today, 04:53
Joined
May 8, 2008
Messages
1
Hi,

I have created a database that allows people to book ICT rooms. People have to enter their "firstname and surname" to book the room, the problem I am having is that other people are coming along and over writing the previous person name and inserting their name and then booking that ICT room. I have no way of seeeing who booked the room first.
If there is some easy way of allowing people to enter their name into the blank field in the form, and then stop other people from over writing the information inputted into the form.

Cheers for all help in advance

MAC
 
I usually use two buttons to open the form.... One to enter data...opens a blank form....the other to view records. On the button to view records I put....
DoCmd.OpenForm stDocName, , , , acFormReadOnly, acWindowNormal, stLinkCriteria
Thus opening the form in read only......
I use split DB's.... so this works fine... My version does not have the "read only" setting allowing me to edit if needed.
 
Sure!

Code:
Private Sub Form_Current()
If IsNull(Me.NameField) Then
  NameField.Locked = False
Else
  NameField.Locked = True
End If
End Sub
 
Sure!

Code:
Private Sub Form_Current()
If IsNull(Me.NameField) Then
  NameField.Locked = False
Else
  NameField.Locked = True
End If
End Sub

What happens if you need to edit a record?;)
 
They'd have to have another way, obviously, but that wasn't the question! He simply wanted to prevent the (apparently) occasional user from editing someone else's reservation. Usually, when this type of thing is done, someone with administrative powers has another form or direct access to the table to make corrections. Giving your philosophy on database design is really not relevant to the OP's question.
 
Well excuse the shit out of me for voicing my philosophy! Proper database design should ALWAYS be on a developers mind. And anticipating the need for resolving future issues that WILL happen is only common sense.
 
Ok, here's my solution...

I didn't want people accidentally (or otherwise) changing any time card records without administrator permission. I added a single field to my table called "TABLE_NAME_lock" and it's a yes or no (checkbox) field.

In each form, in the On Current coding section, I have a check for the lock.

if Whatever_Lock = -1 THEN
me.field1.locked = true
me.field2.locked = true
ELSE
me.field1.locked = false
me.field2.locked = false
EndIf


(Oddly, true for a yes or no field is -1...)


Ok, from here, you should disallow users to see the lock check box by keeping it disabled. Then have a text field at the bottom of the form with a command button. Enter a password into the box and click the button. if the password is correct, the lock button becomes enabled again, so that you can lock/unlock records. :)

I just kept the lock button off of the forms and made a separate Admin Only form that allows me to see a list of records and the lock/unlock button.
 

Users who are viewing this thread

Back
Top Bottom