how can we update data

grad2009

Registered User.
Local time
Today, 05:25
Joined
Feb 7, 2010
Messages
30
hello guys,

i want to prevent the stored data; thats mean if somebody wants to update the data he click on a boutton then he can update ,otherwise he can't update

can you help me please?

thanks with regards,
 
You can set the Allow Edits property of the form with a command button. I sometimes set it to false in the current event and true with a button to prevent accidental changes.
 
thanks for your reply​

is Allow edits a proberty in the property sheet, i can't find it
or do you mean something esle?

 
It is a property of the form itself. It would be visible on the form's property sheet, on the Data tab.
 
Hello its easy:

  1. create a button on the form name it cmdEdit with the caption "Edit"
  2. on button click event: write the following procedure:
Code:
Private Sub cmdEdit _Click()
    Me.YourControlName1.Locked= False
    Me.YourControlName2.Locked= False
    Me.YourControlName3.Locked= False
End Sub

Remember: you have to lock your controls by default when the form open.

This might help:
 
I'm curious why you would lock each control individually when the Allow Edits property will affect them all, with one line of code?
 
I'm curious why you would lock each control individually when the Allow Edits property will affect them all, with one line of code?

you are right Mr. Paul
in this case grad2009 should use the allow Edit method to lock all the controls on form.

in my case: if I want to lock certain controls on the form for certain reason. I use only this technique.
 
Also, using just the code Khalid_Afridi has posted, once the button is clicked the controls on all records will be editable until the form is closed and then re-opened, which defeats the whole purpose of the exercise!

As Paul suggested, in code (not in the Properties pane) in the Form_Current event

Me.AllowEdits

needs to be set to

False.

Then in the Button_Click event

Me.AllowEdits

needs to be set to

True.
 
Oops I am sorry... I wrote vice-versa

It should be:
Code:
Me.YourControlName1.Locked= True
for individual control
Me.AllowEdits is good technique to lock the entire form for editing.

Thanks missinglinq ;)
 
thank you Paul,Khalid,and missinglinq
your answers were wonderfull
regards,
 

Users who are viewing this thread

Back
Top Bottom