Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2006
    Posts
    3

    Unanswered: locking a form section

    I would like to lock a section(the detail section to be specific) on a form via VBA. I will lock it based on which User is currently using the database. I already can pass the User to the form, I just want to be able to lock a section rather than having to lock each individual control.
    Thanks

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    sadly, Mr. Gates did not anticipate this 100% rational requirement.
    either you loop through the controls or you lock the whole form (or, like me, you live in unbound forms so nothing gets saved unless you save it)

    izy


    forgot to mention that my "Detail" is 100%-always a subform --- no issue to lock the entire subform.
    currently using SS 2008R2

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    I just don't know if you can ... The Detail section of a Continuous form doesn't have any useful exposed events (one that do not need explicit firing) where you could put a Locked assignment ...

    Another way of looking at this problem is to assume that no one can access (default each control to locked) and with the right permission allow edit for those controls you desire (Hint: I do this very thing myself) ...
    Back to Access ... ADO is not the way to go for speed ...

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    This too:

    Code:
    Private Sub btnLockDetail_Click()
    Dim varItem As Variant
    
    For Each varItem In Me.Detail.Controls
        If varItem.ControlType <> acLabel Then
            varItem.Enabled = False
        End If
    Next varItem
    
    End Sub
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Ted: Touche!
    Back to Access ... ADO is not the way to go for speed ...

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I know it isn't part of the question but... sometimes you want to "group" controls that are otherwise unrelated (i.e. cannot necessarily lock all the controls in the same section). In that case I tend to use the Tag property of the controls (remember you can select a load of them in design view and update their tag property in one go). Loop though the controls as Teddy demostrated and read the tag property as you go - set the locking appropriate to the logic you use setting the tag.

    Thought I'd mention in case of interest.... now I've reached the end I've realised the answer is "probably not"

    DIT - BTW Izy
    Quote Originally Posted by izyrider
    my "Detail" is 100%-always a subform --- no issue to lock the entire subform.
    Is this just a disconnected thing (as I know from a previous post your "header" records are draw one record at a time from the record souce)?
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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