I have the following code for a form:
[CODE=vb]Private Sub CommentsButton( )
On Error GoTo Err_CommentsBut ton_Click
Dim stDocName As String
Dim stLinkCriteria As String
gPreviousForm = Me.Form.Name
stDocName = "Comments Form"
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_CommentsBu tton_Click:
Exit Sub
Err_CommentsBut ton_Click:
MsgBox Err.Description
Resume Exit_CommentsBu tton_Click
End Sub[/CODE]
I have this code in numerous forms (code works great). The issue is, I would like to make a public sub in a standard module, so I can just call a sub rather than have it in the code of each form. But when I paste it into a standard module, and change Private to Public, I get an error because you can't use "Me" in a standard module. How can I edit the code to reference the current form (Me) without using that term?
[CODE=vb]Private Sub CommentsButton( )
On Error GoTo Err_CommentsBut ton_Click
Dim stDocName As String
Dim stLinkCriteria As String
gPreviousForm = Me.Form.Name
stDocName = "Comments Form"
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_CommentsBu tton_Click:
Exit Sub
Err_CommentsBut ton_Click:
MsgBox Err.Description
Resume Exit_CommentsBu tton_Click
End Sub[/CODE]
I have this code in numerous forms (code works great). The issue is, I would like to make a public sub in a standard module, so I can just call a sub rather than have it in the code of each form. But when I paste it into a standard module, and change Private to Public, I get an error because you can't use "Me" in a standard module. How can I edit the code to reference the current form (Me) without using that term?
Comment