Results 1 to 3 of 3

Thread: subform (XP)

  1. #1
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Kitchener, Ontario, Canada
    Posts
    228
    Thanks
    0
    Thanked 0 Times in 0 Posts

    subform (XP)

    I have a form with a sub form. I do not want the sub form to be usable (read only) until they fill out something in the form. On the form is a auto number text box. So when the text box says "autonumber" I want the sub form locked until the user enters something into 1 of the boxes on the form (this will cause the autonumber text box to update with a number. Once this autonumber field is populated then the sub can be used.

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

    Re: subform (XP)

    You can put code in the On Current event of the main form to lock the subform if the user moves to a new record, and in the Before Insert event of the main form to unlock the subform:

    Private Sub Form_BeforeInsert(Cancel As Integer)
    Me.SubFormName.Locked = False
    End Sub

    Private Sub Form_Current()
    Me.SubFormName.Locked = Me.NewRecord
    End Sub

    Replace SubFormName with the name of the subform as a control on the main form. This is not necessarily the same as the name of the subform in the database window. You can see the control name by opening the main form in design view and clicking once on the subform. The Properties window will show the control name.

  3. #3
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Kitchener, Ontario, Canada
    Posts
    228
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: subform (XP)

    Hans,
    Where would I be without you...STUCK... thanks for all your help time and time again...

Posting Permissions

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