Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alow edits 1

Status
Not open for further replies.

samotek

Technical User
Joined
May 9, 2005
Messages
197
Location
BG


In my subform on the OnCurrent event i have a code that disallows editing:

Me.AllowEdits = Me.NewRecord



This code is perfect, since the user is not alowed to edit records already chosen.
I want to make an exception however, and that is when i want to allow changing the price.
In that case i want to allow the user change the price, and then again revert to the old situation when editing is not allowed
with new records.
However simply writing Me.AllowEdits = True does not help.
I must somehow make invalid the line
Me.AllowEdits= Me.NewRecord

So my question is can i both keep my code in my OnCurrentEvent and also make it false for a given event?
I have a special button called "PriceChange" where on clicking it i want to give this possibility.








 
Surely all you need is:
Code:
Private Sub Form_Current()
    Me.AllowEdits = Me.NewRecord
End Sub
Private Sub PriceChange_Click()
    Me.AllowEdits = True
End Sub
If you then want to restrict so that only certain fields are editable (which I think you do) use (and toggle, where appropriate) each control's Locked property.

[pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top