Solved

How to call this sub from another form

Posted on 2013-05-30
3
442 Views
Last Modified: 2013-06-04
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]
Me.Requery
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
0
Comment
Question by:snyperj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 39208840
First, change
Public Sub BookmarkLine() and End Sub

to

Public Function BookmarkLine()
End Function

Then, call like this

Form_YourActualSubformNameHere.BookmarkLine

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

mx
0
 

Author Closing Comment

by:snyperj
ID: 39218786
Thanks!
0
 
LVL 75
ID: 39219711
You are welcome.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question