Solved

Microsoft, Access, 2007, Call sub without return

Posted on 2008-10-07
2
713 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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 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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of utilizing SQL Server views 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 Access…

746 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

7 Experts available now in Live!

Get 1:1 Help Now