Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    On Load Event (2003 sp2)

    I have a form with a sub form. As the record changes in the form the records change in the sub form. With each change in the sub form is the on load event triggered?
    Thanks
    chuck

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

    Re: On Load Event (2003 sp2)

    No, only when the main form is opened.

  3. #3
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: On Load Event (2003 sp2)

    I have a calculated field on the sub form and when it reaches 80 I want the forms allow edits property to be set to False, and when a new record is started and the value is less than 80 to be set to True. I set the sub forms allow edits property to false and used the following code:
    If Me.Hours2 <> 80 Then
    Me.AllowEdits = True
    End If

    Problem is I can't get it to work. I have attached a database.
    Thanks
    chuck

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

    Re: On Load Event (2003 sp2)

    Try the On Current event:

    Private Sub Form_Current()
    ' Update the calculated controls NOW
    Me.Recalc
    ' Set AllowEdits
    Me.AllowEdits = (Nz(Me.Hours2, 0) < 80)
    End Sub

  5. #5
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: On Load Event (2003 sp2)

    Works beautifully! Thanks so much.
    Thanks
    chuck

Posting Permissions

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