Results 1 to 2 of 2
2005-05-24, 13:29 #1
- 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
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,
2005-05-24, 13:51 #2
- Join Date
- Mar 2002
- Thanked 30 Times in 30 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.