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

Forms: Conditional Allow Edits?

Status
Not open for further replies.

csunsun

Technical User
Apr 29, 2003
41
US
Hi,

If my check box named "CheckBoxStep3" is checked I do NOT want edits allowed on the form.

If the check box "CheckBoxStep3" is not checked then edits are allowed.

My code is not working! Please help...thanks!

Private Sub Form_Current()
If Me.CheckBoxStep3 = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If

End Sub
 
Your code looks fine, but if you want to affect the current record you are working on then add:

Private Sub strMiddleInitial_Click()
Me.Recalc
If Me.CheckBoxStep3 = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub

I tried in the after update and it did not work, I do not understand why not. I need to think about it. Also I needed to add the recalc, and again not sure why.
 
How are ya csunsun . . .

If its not working ([blue]code seems fine[/blue]) then the [purple]checkbox has to be unbound![/purple] . . . is this correct?

Calvin.gif
See Ya! . . . . . .
 
Any programmatic change to a bound control let the current record updatable until saved, despite the value of AllowEdits.
So my guess:
Me.Dirty = False
Me.AllowEdits = Not Me!CheckBoxStep3

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top