Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Mar 2005
    Leicestershire, United Kingdom
    Thanked 0 Times in 0 Posts

    Field in parent to determine subform (2000)


    I have a main form with a subform of viewings on it. I have the code on Before insert for the form frmViewings which reads: -

    Dim varsalesid As Variant
    Dim strlogon As String

    'Find logon information
    strlogon = Environ("Username")
    varsalesid = DLookup("[SALESID]", "tblsalesman", "Winlogon=" & Chr(34) & strlogon & Chr(34))

    If Not IsNull(varsalesid) Then
    SALESMANID = varsalesid

    If Parent!ACCOMPVIEW = True Then
    Me!AVIEW = True
    End If
    End If

    Me!CREATDATE = Date

    However when creating a new record it does not put a tick in the AView yes/no field.

    Any ideas?
    Best Regards,


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Field in parent to determine subform (2000)

    Click in the line Private Sub Form_BeforeInsert and press F9 to set a breakpoint.
    Switch to Access, open the form and create a new record in the subform. The code willl pause. You can execute the code step by step by pressing F8. You can see what the code does, and you can inspect the value of variables/controls by hovering the mouse pointer over them.
    See if you can find out what happens.

Posting Permissions

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