Main form not recognized in code line for subform control

  • Thread starter cyberwolf0000 via AccessMonster.com
  • Start date
C

cyberwolf0000 via AccessMonster.com

I have a form (frm_Reprints) with a subform (frm_ReasonCodes_subform). When
I added code to the subforms control "Enter" Event, I get an Error 40036
Application defined or User-Defined Error. It seems to be not recoginzing
the main forms name. The reason I believe this is because when I type out
the code it doesn't capitalize the main forms name like I would expect it to.
I did a debug.print me.form.name and it came back like "frm_Reprints". Below
is the code line causing the error.

If Forms!frm_reprints!frm_ReasonCodes_subform.Form!ReasonID = "Rejected
Preprint" Then

I tripled checked all form names the subform control name and the names of
the controls on the subform and just can't figure this one out.

I have tried many variations on this with no luck.

TIA

--
James B Gaylord
For the Wolf comes the strength of the Pack,
For the Pack comes the strength of the Wolf,
-R. Kipling
Office 2003 on Win XP SP2
 
C

cyberwolf0000 via AccessMonster.com

I forgot to post the entire procedures code:

Private Sub frm_ReasonCodes_subform_Enter()

' On Error GoTo frm_ReasonCodes_subform_Enter_Error
Debug.Print Me.Form.Name

strWhere = "[ReprintID]=" & Forms!frm_reprints!ReprintID
If Forms!frm_reprints!frm_ReasonCodes_subform.Form!ReasonID = "Rejected
Preprint" Then
intResp = MsgBox("There are Rejected Pre-Print codes associated with
this record," & vbCrLf _
& "Would you like to view the Pre-Print Rejection
codes?", vbYesNoCancel, "Rejected Pre-Print!")
If intResp = vbYes Then
DoCmd.OpenForm "frm_RPPCauseInfo", acNormal, , strWhere,
acFormReadOnly, acDialog
End If
End If

On Error GoTo 0
Exit Sub

frm_ReasonCodes_subform_Enter_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
frm_ReasonCodes_subform_Enter of VBA Document Form_frm_Reprints"
End Sub

I have a form (frm_Reprints) with a subform (frm_ReasonCodes_subform). When
I added code to the subforms control "Enter" Event, I get an Error 40036
Application defined or User-Defined Error. It seems to be not recoginzing
the main forms name. The reason I believe this is because when I type out
the code it doesn't capitalize the main forms name like I would expect it to.
I did a debug.print me.form.name and it came back like "frm_Reprints". Below
is the code line causing the error.

If Forms!frm_reprints!frm_ReasonCodes_subform.Form!ReasonID = "Rejected
Preprint" Then

I tripled checked all form names the subform control name and the names of
the controls on the subform and just can't figure this one out.

I have tried many variations on this with no luck.

TIA

--
James B Gaylord
For the Wolf comes the strength of the Pack,
For the Pack comes the strength of the Wolf,
-R. Kipling
Office 2003 on Win XP SP2
 
C

cyberwolf0000 via AccessMonster.com

I figured it out. I had a public Dim set-up that caused the issue. Once I
removed that it worked fine.

Thanks anyway
I have a form (frm_Reprints) with a subform (frm_ReasonCodes_subform). When
I added code to the subforms control "Enter" Event, I get an Error 40036
Application defined or User-Defined Error. It seems to be not recoginzing
the main forms name. The reason I believe this is because when I type out
the code it doesn't capitalize the main forms name like I would expect it to.
I did a debug.print me.form.name and it came back like "frm_Reprints". Below
is the code line causing the error.

If Forms!frm_reprints!frm_ReasonCodes_subform.Form!ReasonID = "Rejected
Preprint" Then

I tripled checked all form names the subform control name and the names of
the controls on the subform and just can't figure this one out.

I have tried many variations on this with no luck.

TIA

--
James B Gaylord
For the Wolf comes the strength of the Pack,
For the Pack comes the strength of the Wolf,
-R. Kipling
Office 2003 on Win XP SP2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top