Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2013
    Posts
    2

    Unanswered: Enabling/Disabling Dataheets Rows

    Hi there

    I'd be most grateful if anyone, out there, could let me know how to disable a row in a datasheet.

    Each Row/Record has a checkbox field. However, some records should have the checkbox disabled based on certain values. I tried to use the Current Event of the datasheet but, it disabled the entire field of the datasheet.

    Thanks
    xyMarshall

  2. #2
    Join Date
    Jan 2009
    Location
    Kerala, India
    Posts
    183
    If you would like to Enable/Disable individual fields based on some condition then you can do it. Remember, when you attempt to disable a particular control you see that the current focus is not on that field (shift the focus from that field to some other enabled field).

    Check the following sample code:

    Code:
    Private Sub Form_Current()
    If Not Me.NewRecord Then
      If Me![Completed] Then
         If Me![Project].Enabled = True Then
            Me.ID.SetFocus
            Me![Project].Enabled = False
            Me.Refresh
         End If
       Else
         If Me![Project].Enabled = False Then
            Me![Project].Enabled = True
            Me.Refresh
         End If
       End If
    End If
    End Sub
    The control [Completed] is a check-box field.

    The statement:
    Code:
    If Not Me.NewRecord Then
    .
    .
    End if
    ensures that the routine is not run on a new and empty record.
    www.MsAccessTips.com (Learn MS-Access Tips & Tricks)
    Learn Advanced MS-Access Programming with sample VBA Code.

    All responses are based on Access 2003/2007

  3. #3
    Join Date
    Sep 2013
    Posts
    2
    apr pillai!!! ... You're a star. Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •