Solved

Microsoft, Access, 2007, Call sub without return

Posted on 2008-10-07
2
716 Views
Last Modified: 2013-11-28
Hi

I have an if statement where, if something is true, a sub procedure is called which performs various operations and then closes the current form.  I don't want to return to the orginal procedure once the sub has been completed.  If I use Call, it returns.  How do I tell Access to go to a sub procedure and not return?  I have an idea I might need to use Function, but I don't know how to so, if that's the correct way of doing it, please could someone tell me how to use it?  If not, please could tell me someone how I call a sub without returning?

Thanks
Sarah
0
Comment
Question by:ScuzzyJo
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 22657752
You cannot do so.
A procedure - whether a sub or a function- is defined as a 'temporary branch' from the current flow and will always return to the originating code.

If you want to close the form after the procedure has run then you should put the close form command immediately after the call to the sub/function in the calling procedure.
0
 

Author Closing Comment

by:ScuzzyJo
ID: 31503754
Hi Peter
Thanks.  I had a nasty suspicion that might be the case...:-(  The If was inside a Do.....Loop.  I seem to have solved it by putting an Exit Do on the return, but I had fun trying to get the End If in the right place.  It works now though, so thanks.
Sarah
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

932 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

15 Experts available now in Live!

Get 1:1 Help Now