473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

What happens in procedure 1 the very instant sub procedure 2 is called?

MLH
Consider the following class module...
Option Compare Database
Option Explicit

Private Sub Command0_Click()
MsgBox "One"
Call MySub
MsgBox "Three"
End Sub

-------------------------------------------------------------

Private Sub MySub()
MsgBox ("Two")
End Sub

When the Call MySub line is executed in Sub Command0_Click,
are remaining lines to be processed in the first Sub completely
suspended until processing in Sub MySub is completed. Is there
EVER any possibility of any lines in the first sub being processed
until Sub MySub is completely finished or terminated earlier by
error?

To make the question perfectly clear - is there any possibility that
lines from both subs could EVER be processing in 2 concurrent
threads?
Nov 13 '05 #1
4 1328
MLH <CR**@NorthState.net> wrote in
news:al********************************@4ax.com:
To make the question perfectly clear - is there any
possibility that lines from both subs could EVER be processing
in 2 concurrent threads?


That won't happen, as long as the code is in the same module, and
not triggered from an event

Put a second command button on a form, and you can get interleaving
from each of the two subs.

If you have code in a form that opens a second form, the code in
each form may run concurrently with the code from the other form.

--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #2
MLH
Thx, Bob.
xxxxxxxxxxxxxxxxxxxxx

That won't happen, as long as the code is in the same module, and
not triggered from an event

Put a second command button on a form, and you can get interleaving
from each of the two subs.

If you have code in a form that opens a second form, the code in
each form may run concurrently with the code from the other form.


Nov 13 '05 #3
MLH <CR**@NorthState.net> wrote in
news:al********************************@4ax.com:
Consider the following class module...
Option Compare Database
Option Explicit

Private Sub Command0_Click()
MsgBox "One"
Call MySub
MsgBox "Three"
End Sub

-------------------------------------------------------------

Private Sub MySub()
MsgBox ("Two")
End Sub

When the Call MySub line is executed in Sub Command0_Click,
are remaining lines to be processed in the first Sub completely
suspended until processing in Sub MySub is completed. Is there
EVER any possibility of any lines in the first sub being processed until Sub MySub is completely finished or terminated earlier by
error?

To make the question perfectly clear - is there any possibility
that lines from both subs could EVER be processing in 2 concurrent threads?


Well, that depends entirely on what you're calling code does.

If it's asynchronous, it will return control back to the original
context and continue executing the next line. If it's not, it
won't.

There's no way to say for sure without knowing exactly what code
you're calling.

If, for instance, your called MySub() makes a call to Shell() it
will return control back to the calling sub before Shell() has
finished, since Shell() always executes asynchronously (it you want
to avoid that with Shell(), look up ShellAndWait() on the Access
web).

Another example: DoCmd.OpenForm executes asynchronously when you
don't use the acDialog argument.

THe answer to your question is entirely dependent on what your code
does.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #4
MLH
Well then, there are instances in which it can go either way.
Alright. That will be handy to know if there are any dependencies
I'm counting on in code that might NOT be suspended. Would
be tough for me to have known this if I were to be caught in
some kind of race condition that was prducing an error as a
result.

Thx, David.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxx

Well, that depends entirely on what you're calling code does.

If it's asynchronous, it will return control back to the original
context and continue executing the next line. If it's not, it
won't.

There's no way to say for sure without knowing exactly what code
you're calling.

If, for instance, your called MySub() makes a call to Shell() it
will return control back to the calling sub before Shell() has
finished, since Shell() always executes asynchronously (it you want
to avoid that with Shell(), look up ShellAndWait() on the Access
web).

Another example: DoCmd.OpenForm executes asynchronously when you
don't use the acDialog argument.

THe answer to your question is entirely dependent on what your code
does.


Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
by: jacob navia | last post by:
I would like to add at the beginning of the C tutorial I am writing a short blurb about what "types" are. I came up with the following text. Please can you comment? Did I miss something? Is...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
7
by: divya | last post by:
What is an equivalent TimeSerial() function of VBscript in the Java Script?? I have two variables hour and minutes. Timeserial(hour,minutes) returns the time hour : minutes. But I want to do...
10
by: Bishoy | last post by:
Hi, In VB.NET there is a keyword called "My" which has a lot of properties collected at it. Is there any equivalent to this "My" in C#? Thank you.
25
by: GY2 | last post by:
I writing some documentation and I want to describe a common code structure which is used to step through all the items in a collection (e.g. each file in a subdirectory) while applying more and...
12
by: rodchar | last post by:
hey all, vb has a static keyword for variables, what is charp's equivalent,please? static tempVar as String thanks, rodchar
11
by: emailus | last post by:
I am webmaster for the domain <www.alpha1.org.au>. Not being an expert in html, I take advantage of my domain Registrant's web building tool, 'Instant Website'. This tool is provided as part of...
2
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
66
by: John | last post by:
Hi What are the advantages actually achieved of managed code? I am not talking of theory but in reality. Thanks Regards
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.