Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    global function (Access 2000)

    How can i build the folloiwng properties into a function:
    AllowDeletions = False or True
    AllowEdits = False or True
    Locked = Yes or No
    Enabled = False or True
    i want to use this function for different controls.I will call this function Bar and also put the name control in the function.So if i have a control buildings,to set the properties as Bar = False

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: global function (Access 2000)

    AllowDeletions and AllowEdits are properties of a form as a whole. Enabled and Locked are properties of individual controls. So it doesn't make sense to set all of them in one function or procedure.

    Here is a procedure for controls:
    <code>
    Public Sub EnableControl(ControlName As String, Flag As Boolean)
    With CodeContextObject.Controls(ControlName)
    .Locked = Not Flag
    .Enabled = Flag
    End With
    End Sub
    </code>
    Call it like this to enable/unlock a control named Buildings:
    <code>
    Call EnableControl("Buildings", True)
    </code>
    and like this to disable/lock a control named Cartons:
    <code>
    Call EnableControl("Cartons", False)</code>

  3. #3
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: global function (Access 2000)

    Thank you for this excellent advice

Posting Permissions

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