calling function without wait

R

Roy Goldhammer

Hello there

When i run function from modul in access or in vb and call to diffrent
function, the exeution of the current function waits until the calling
function finished.

However if i use shell the function doesn't wait.

Is there a way to call funcion that don't wait?
 
S

Stefan Hoffmann

hi Roy,

Roy said:
When i run function from modul in access or in vb and call to diffrent
function, the exeution of the current function waits until the calling
function finished.
However if i use shell the function doesn't wait.
Huh? Can you give us an example, please?
Is there a way to call funcion that don't wait?
For functions in VBA this is not possible.


mfG
--> stefan <--
 
R

Roy Goldhammer

Of course

I build software to present table data
and i need to open the same form more then once (which is impossible as far
as i know).

In order to do so i have master form and when i "open table" i create copy
of the form in new name with table name.

When I close the form it will be deleted.

in order to do so i would like to create function that delete the form only
if it is not loaded. and to activate it i would like to run it from form
close and wait until it closed then delete it
 
S

Stefan Hoffmann

hi Alex,

Alex said:
you can somehow emulate this, for example you open a form and it's timer
event runs another function in 1 sec
I don't think that is close to an async, parallel execution of
functions. btw, in his answer he described imho something completely
different.


mfG
--> stefan <--
 
S

Stefan Hoffmann

hi Roy,

Roy Goldhammer wrrote:
I build software to present table data
and i need to open the same form more then once (which is impossible as far
as i know).
http://allenbrowne.com/ser-35.html
http://msdn2.microsoft.com/en-us/library/bb243775.aspx

In order to do so i have master form and when i "open table" i create copy
of the form in new name with table name.
You can use the forms OpenArgs parameter:

Dim OpenArgs As String
OpenArgs = "yourTablename"
DoCmd.OpenForm "yourFormName", , , , , , OpenArgs

and in the form open event you can apply it:

Private Sub Form_Open(Cancel As Integer)

If Len(Trim(OpenArgs)) > 0 Then
Debug.Print "OpenArgs value = '" & OpenArgs & "'"
Recordsource = OpenArgs
End If

End Sub



mfG
--> stefan <--
 
G

George Nicholson

I'm not sure this addresses your question, but consider these functions (in
a general module):

****************************
Public Function IsLoaded(strObjName As String, Optional lngObjType As
acObjecttype = acForm) As Boolean
' Returns True if strName is Open (non-zero), False(0) otherwise.
' Should return 0, not an error, if the object doesn't exist
' Default Object is Form
On Error Resume Next
IsLoaded = (SysCmd(acSysCmdGetObjectState, lngObjType, strObjName) <> 0)
End Function

Public Sub WaitUntilClosed(strObjName As String, Optional lngObjType As
acObjecttype = acForm)
' Suspends code execution while object is open. Default object is a
Form.
On Error Resume Next
Do While IsLoaded(strObjName, lngObjType)
DoEvents
Loop
End Sub

***************************************

Then your 'active' code might look something like:
(untested aircode)

DoCmd.CopyObject , "frmTestCopy", acForm, "frmTest"
DoCmd.OpenForm "frmTestCopy"
Call WaitUntilClosed("frmTestCopy", acForm)
DoCmd.DeleteObject acForm "frmTestCopy"

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top