From: saintor1 on
Access XP. My form has tabs, two of them have a subform (frmCarDet
that can be edited or not, and frmEventLog always editable).

When there is a date in closedon, "allowedits" is at false.
Everything works great as long as I stay in form mode.

I added the possiblity to browse quicker by using the datasheet
mode. I don't want people to add, modify, delete records in this
mode.

So here is the code;

Private Sub Form_Current()

Select Case Me.CurrentView
Case 1
Me.AllowAdditions = True
Me.AllowDeletions = True

If IsNull(Me.ClosedOn) = True Then
Me.AllowEdits = True
Me.Form!frmCarDet.Locked = False
Else
Me.AllowEdits = False
Me.Form!frmCarDet.Locked = True
End If

Me.Form!frmEventLog.Locked = False

Case 2
Me.AllowAdditions = False
Me.AllowDeletions = False
Me.AllowEdits = False

End Select

End Sub

Problem is when I toggle from datasheet to form. The subforms
frmCarDet and frmEventLog can not be edited and I have no idea why.
Again as long as I never went to datasheet, I am fine and both are
editable when there is nothing in closedon. If I change to form from
datasheet, all the fields are editable but *both* subforms.

I tried to add

Private Sub Form_ViewChange(ByVal Reason As Long)
Form_Current
End Sub


Same result. I think that my subforms are just not recognized from
datasheet. Any idea / alternative way to achieve this?

Thanks in advance.