Graceful Method Of Making Single Record Non-Editable?

P

(PeteCresswell)

I've got a continuous list subform.

One of the rows is identified by !IsBuyDependent=True.

I want this row, but none of the others tb non-editable.

My best shot so far is:
--------------------------------------
Private Sub txtResetDate_Enter()
With Me
If .txtIsBuyDependent = True Then
Beep
.txtDummy.SetFocus
End If
End With
End Sub
-------------------------------------

Where .txtDummy is an unbound field
with .BackStyle and .BorderStyle = Transparent;
..TabStop=False - sitting over top of a percent
label on the same line.

Screen snap at http://tinyurl.com/37mp7b
Click the little "All Sized" icon above
the pic to see a larger version.

Seems to work: user tabs or clicks into txtResetDate,
cursor jumps to the dummy field, and the percent sign
label underneath it is temporarily obscured until the
user clicks somewhere else.

Anybody got something better?
 
D

David W. Fenton

I've got a continuous list subform.

One of the rows is identified by !IsBuyDependent=True.

I want this row, but none of the others tb non-editable.

I don't use editable continuous forms, on the whole. The only
exception where I use them frequently is in something like an
invoice.
 
D

Dirk Goldgar

(PeteCresswell) said:
I've got a continuous list subform.

One of the rows is identified by !IsBuyDependent=True.

I want this row, but none of the others tb non-editable.

My best shot so far is:
--------------------------------------
Private Sub txtResetDate_Enter()
With Me
If .txtIsBuyDependent = True Then
Beep
.txtDummy.SetFocus
End If
End With
End Sub
-------------------------------------

Where .txtDummy is an unbound field
with .BackStyle and .BorderStyle = Transparent;
.TabStop=False - sitting over top of a percent
label on the same line.

Screen snap at http://tinyurl.com/37mp7b
Click the little "All Sized" icon above
the pic to see a larger version.

Seems to work: user tabs or clicks into txtResetDate,
cursor jumps to the dummy field, and the percent sign
label underneath it is temporarily obscured until the
user clicks somewhere else.

Anybody got something better?


I don't quite follow. If you want to protect the whole row from edits, why
not use the form's Current event:

Private Sub Form_Current()

Me.AllowEdits = Not (Me!IsBuyDependent)

End Sub

If you also want to change the appearance of the row accordingly, you
probably need to look at Conditional Formatting. Other solutions on
continuous forms are much harder to implement.
 
J

John W. Vinson

I've got a continuous list subform.

One of the rows is identified by !IsBuyDependent=True.

I want this row, but none of the others tb non-editable.

My best shot so far is:
--------------------------------------
Private Sub txtResetDate_Enter()
With Me
If .txtIsBuyDependent = True Then
Beep
.txtDummy.SetFocus
End If
End With
End Sub
-------------------------------------

Where .txtDummy is an unbound field
with .BackStyle and .BorderStyle = Transparent;
.TabStop=False - sitting over top of a percent
label on the same line.

Screen snap at http://tinyurl.com/37mp7b
Click the little "All Sized" icon above
the pic to see a larger version.

Seems to work: user tabs or clicks into txtResetDate,
cursor jumps to the dummy field, and the percent sign
label underneath it is temporarily obscured until the
user clicks somewhere else.

Anybody got something better?

I'd use the Form's BeforeUpdate event:

Private Sub Form_BeforeUpdate(Cancel as Integer)
Cancel = Me!IsBuyDependent
End Sub

This will just silently undo any changes made to that record. You can of
course make it noisely undo such changes if you prefer.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top