Access Datasheet Forms

  • Thread starter Thread starter Clint Liezert
  • Start date Start date
C

Clint Liezert

Is there a way to lock or prohibit data entry in a
datasheet based on a value of a different column in the
same datasheet. In other words, if column A contains a
1, then I want to be able to enter data in column K. If
column A contains any other value, I don't want data
entered in K.
 
Sure; one of the easier methods is to set the Locked, Enabled, Tab Stop
properties of your control "K" based on the value in control "A". This will
be effective for each record.

In the AfterUpdate event of control Me![myText-A] put:
If Me![myText-A] = "1" Then
Me![myText-K].Locked = Yes 'disallows changing value in "K"
Me![myText-K].Enabled = No 'disallows "K" getting focus
Me![myText-K].TabStop = No 'disallows tabbing, enter key movement
into "K"
Else
Me![myText-K].Locked = No
Me![myText-K].Enabled = Yes
Me![myText-K].TabStop = Yes
End If
End Sub

You may use any/all of those 3 lines depending on your needs. If your
control "A" is bound to a number field, skip the quotes around 1.
-Ed
 
Back
Top