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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AllowEdits switch 1

Status
Not open for further replies.

andzejek

MIS
Sep 1, 2007
154
US
Hi!

Is there any reason why this switch is working only once? I'm loading form with AllowEdits=false and want to switch it later as much as I need. It is switching it to AllowEdits=true just once and it is not switching it back to false. Here is the code:

Private Sub CMD_EDIT_Click()

If Me.AllowEdits = True Then
Me.CMD_EDIT.Caption = "Edit"
Me.AllowAdditions = False
Me.AllowEdits = False
Else
Me.AllowAdditions = True
Me.AllowEdits = True
Me.CMD_EDIT.Caption = "Save"
End If

End Sub

Andrew
 
The code works for me. Is it possible that code is running elsewhere that interferes?
 
No this is only place where it is.
Is this maybe matter of Access version? I'm working with MsAccess2000.
 
That is the version I tested. Perhaps you could step through the code?
 
Can you explain 'doing nothing' a little more? For example, is the code running at all?
 
Thanks Remou!

"doing nothing" -> not executing command Me.AllowEdits = False. Just line abowe(ok two) I have comand switching/changing caption of the command buton to "Edit" Me.CMD_EDIT.Caption = "Edit" and thiscommand is executed and working.

Andrew
 
Is this a bound form? How are you determining that the code has not run?
 
I placed message box before and after "Me.AllowEdits = False". Both message boxes were triggered, button changed caption from "Save" to "Edit", but I was still able to edit text in textboxes
 
Ok. This is quite puzzling. Pehaps it would be worth trying a scratch form with a few bound controls and the edit button with code, but nothing else.
 
This same. New form is working this same way, switching to allowedits=true but not back
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top