Solved

How to call this sub from another form

Posted on 2013-05-30
3
401 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
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now