Results 1 to 5 of 5
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subform link fields behavior (2003)

    db1.mdb

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

    Re: Subform link fields behavior (2003)

    In both databases, the On Current event of the subform occurs several times when the main form is opened. The first time, the date field has the value from the first record in the underlying table (the link with the main form hasn't been activated yet), the second and third time, the date field is null.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Subform link fields behavior (2003)

    If you put a break point at the code line:
    <font color=red>If Not IsNull(DGIOR) Then</font color=red>
    in the Private Sub Form_Current()
    for the Gruppo5 subform of the attached db2.mdb, you can see the value of DGIOR corresponds to the value DGIOR has in the first record of the Gruppo5 form Record Source, namely 01/01/2005.

    What I don't understand is why, when you put a break point at the code line:
    <font color=448800>If Not IsNull(DGIOR) Then</font color=448800>
    in the Private Sub Form_Current()
    for the MG2Maz subform of the db1.mdb, which uses virtually identical code, you can see the value of DGIOR is Null.
    I mean, when you both open the Gruppo5 and MG2Maz subforms, the calendar on the main form is set to the current day for which the record source in both cases has no record so why the different behaviour?

  4. #4
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subform link fields behavior (2003)

    Thank you Hans.
    In the case of db2.mdb, I'm trying to make it so that when, on the main form calendar, you select the first day whose record is yet to be filled out on the Gruppo5 subform(April 4, 2005 in the db2.mdb attached at the start of the thread), the LETT, SERV and CONG text boxes on the Gruppo5 subform show the value of the previous day. I've put the code that's supposed to do that in the Private Sub Form_Current() for the Gruppo5 subform but it gives seemingly erratic results. Where am I going wrong?

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

    Re: Subform link fields behavior (2003)

    Gruppo5 is linked to VilladiSerio on DGIOR vs Giorno. If you select April 4, 2005 in the calendar on the main form, there is no record in the main form or in the subform, so DGIOR is null. You can't have a record in the subform if there is no master record in the main form.

Posting Permissions

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