I am just new at using this code, so have probably made a really simple mistake.
My code works fine just in the sub form I created it, but when putting the sub form in the main form, the code does not work as it says it "can't find the form SUPER Pension Sub Form referred to in a Macro Expression or Visual Basic. Code"
Code as follows:
Expand|Select|Wrap|Line Numbers
- Dim stDocName As String
- stDocName1 = "SUPER Pension Request Letter TTR"
- stDocName2 = "SUPER Pension Confirmation Letter"
- If Forms![SUPER Pension Sub Form]![Type of Pension] = 1 Then
- DoCmd.OpenReport stDocName1, acPreview, , "[SUPER Pension Table]![Member Name]=Forms![SUPER Pension Form]![Member Name]"
- Else
- DoCmd.OpenReport stDocName2, acPreview, , "[SUPER Pension Table]![Member Name]=Forms![SUPER Pension Form]![Member Name]"
- End If