Form.AllowEdits = False ?

  • Thread starter Thread starter Eric G
  • Start date Start date
E

Eric G

I'm currently using the following code that's attached to a command
button which allows editing the last record, when the button is
clicked. The problem is that it also allows editing of all the
records.

Would someone be able to help me change this code to allow editing of
the last *and only the last* record?

If [Forms]![frmPassword]![cboUserID] =
Forms![frmTab]![frmTabDet].Form![TeacherID] Then
frmTabDet.Form.Recordset.MoveLast
frmTabDet.Form.AllowEdits = True
End If

TIA Eric
 
Eric G said:
I'm currently using the following code that's attached to a command
button which allows editing the last record, when the button is
clicked. The problem is that it also allows editing of all the
records.

Would someone be able to help me change this code to allow editing of
the last *and only the last* record?

If [Forms]![frmPassword]![cboUserID] =
Forms![frmTab]![frmTabDet].Form![TeacherID] Then
frmTabDet.Form.Recordset.MoveLast
frmTabDet.Form.AllowEdits = True
End If

You can't change *this* code to make that happen, but you can add code
to the Current event of frmTabDet to set AllowEdits to False each time
the form moves to a different record. That way, if the user switches to
a different record on the subform, AllowEdits will automatically be set
to False. Only your code will set AllowEdits to True.
 
Thank you very much Dirk, it's working like a charm now!

Eric


Eric G said:
I'm currently using the following code that's attached to a command
button which allows editing the last record, when the button is
clicked. The problem is that it also allows editing of all the
records.

Would someone be able to help me change this code to allow editing of
the last *and only the last* record?

If [Forms]![frmPassword]![cboUserID] =
Forms![frmTab]![frmTabDet].Form![TeacherID] Then
frmTabDet.Form.Recordset.MoveLast
frmTabDet.Form.AllowEdits = True
End If

You can't change *this* code to make that happen, but you can add code
to the Current event of frmTabDet to set AllowEdits to False each time
the form moves to a different record. That way, if the user switches to
a different record on the subform, AllowEdits will automatically be set
to False. Only your code will set AllowEdits to True.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top