(see responses in-line below)
StuJol said:
Now that we are back on good terms (I think) i would like to discuss further
the code you surgested. I understand if you dont reply
I used the following code
Private Sub Form_Open(Cancel As Integer)
If Me!cboStatus = "Closed" Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End if
End Sub
Bit it didnt reconise Me!cboStatus so i removed the cbo and left it as
Status (which is the name of the combo box) I've tried to find what cbo means
but are unable to find it in help. i can only assume it is short hand for
combobox and does not serve as any kind of control. Anyhow when i put my form
into run mode i am not able to edit any fields no matter what the status of
the status combo is. When i change the code to
The example was only an example -- and you realized that you needed to use
the name of your control. I use a prefix on my controls to remind me what
type of control they are (and "cbo" is short for "combo box").
Private Sub Form_Open(Cancel As Integer)
If Me!cboStatus = "Closed" Then
Me.AllowEdits = True
Else
Me.AllowEdits = False
End if
End Sub
Then when i run the form i can do edits no matter what the status of the
status combo box is. Its as if the code isnt reading the status of the combo
box. Any idea's please
From your description, you are working to handle the situation when the form
first opens. This doesn't help you when you change the status, nor when you
load a new record. To handle those two events, you'd need to add code to
the combo box's AfterUpdate event, and to the form's "Current" event. You
may not need to do the code in the form's "Open" event.
Regards
Jeff Boyce
<Access MVP>