Results 1 to 2 of 2

Thread: Locked control

  1. #1
    Join Date
    Oct 2005
    Posts
    23

    Unanswered: Locked control

    Can you help me ? I have 2 controls on the subform, called cartons and quantity.I want to make the control quantity be locked and not enabled when i enter something. Therefore on the OnEnter event of the control i have the command Me!Quantity.Locked = True
    Howeverr, i have a delete command in the quantity control and somehow the control is not locked and carries out the delete command which is not what i want.Can you help me ?

    The command in the double click event of Quantity is :

    Private Sub Quantity_DblClick(Cancel As Integer)
    Call EnableControl("Cartons", True)
    Forms![Productspopup].Visible = False
    If IsNull(Me!Quantity) Then
    MsgBox " no items ! "
    Exit Sub
    DoCmd.Beep
    Else
    If Parent!ChkSubOrder = False Then
    Call EnableControl("Cartons", True)
    deletearecordQuantity ' with this function i delete the chosen product
    End If
    End If
    End Sub

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    From Access Help:
    "The Locked property specifies whether you can edit data in a control in Form view"

    Therefore, it wouldn't stop a double-click event from happening.
    Just add another IF to your code:

    IF Me!Quantity.Locked=True Then
    Exit Sub
    End If
    Inspiration Through Fermentation

Posting Permissions

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