What exactly are you trying to prevent?
Going to that particular cell?
You don't want to highlight the entire contents you just want to go to the end of the string?
You don't want that field to be editable?
You don't want that field to be available at all other than visible?
If you are trying to go to the end of the line so they don't accidentally overwrite what's in the field I use this function:
Code:
Public Function pfLP() '(ctl As Control, lngWhere As Long)
On Error GoTo ERRHANDLER
If Screen.ActiveControl.Enabled = True Then
If InStr(Screen.ActiveControl.Tag, "ED") > 0 Then
'ED in the string indicates a date value
If IsNull(Screen.ActiveControl.Value) Then
'Empty Date
Screen.ActiveControl.SelStart = Screen.ActiveForm(Screen.ActiveControl.Name & "").SelLength
Else
'Date present with \ marks
Screen.ActiveControl.SelStart = Screen.ActiveForm(Screen.ActiveControl.Name & "").SelLength + 2
End If
Else
'other text or numeric field
Screen.ActiveControl.SelStart = Screen.ActiveForm(Screen.ActiveControl.Name & "").SelLength
End If
End If
Exit Function
ERRHANDLER:
Resume Next
End Function
You may have to modify it to look at a subform field, I don't use subforms so I'm not entirely sure if it would work without modification. NOTE this relies on any DATE field to have a tag of ED, I suppose you could change it to look and see if the field is formatted a particular way the tag function is just easier for me all around.