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
Solved

How to call this sub from another form

Posted on 2013-05-30
3
426 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 - 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

809 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