Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Microsoft, Access, 2007, Call sub without return

Posted on 2008-10-07
2
Medium Priority
?
731 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
[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 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 2000 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

721 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