How to call this sub from another form

I have a Form I will call frm1
I have a subform on that form I will call sfrm1

On sfrm1, I have the following code:

Public Sub BookmarkLine()

Dim vLine As Long
Dim rs As DAO.Recordset

vLine = Me.[Line_No]
Set rs = Me.RecordsetClone
rs.FindFirst "[Line_No]=" & vLine
Me.Bookmark = rs.Bookmark

End Sub

I need to call BookmarkLine(), from another standalone form I will call frm2.  Basically, when a command button on frm2 is clicked, I need it to call BookmarkLine()

Please help with the synatax of the command button to make the call.   Thanks
Who is Participating?
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
First, change
Public Sub BookmarkLine() and End Sub


Public Function BookmarkLine()
End Function

Then, call like this


Be sure YourActualSubformNameHere is the name of the 'subform' as it appears in the database window (or Navigation pane)

snyperjAuthor Commented:
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
You are welcome.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.