making data read-only as soon as entered

  • Thread starter Thread starter Deepak
  • Start date Start date
D

Deepak

Hi

In a subform (as datasheet), i want to make data "read-only" as soon as it
is entered.

plz suggest.


reg
deepak
 
Deepak said:
In a subform (as datasheet), i want to make data "read-only" as soon as it
is entered.

Using the LostFocus event, lock the control. Something like (aircode):

Sub txtMyControl_LostFocus()
If Len(txtMyControl & vbNullString) > 0 Then
Me.txtMyControl.Locked = True
End If
End Sub

Also lock any record which not new:

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

Note: This doesn't keep anyone out of the tables. To do that you'll need to
enable Access User-Level security and deny permissions on the tables. You
then allow access to the data through queries which have owner's
permissions.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top