using the acDialog mode on forms`

CHAOSinACT

Registered User.
Local time
Today, 21:58
Joined
Mar 18, 2009
Messages
235
ok, did some reading on loading forms in the acDialog setting. all SEEMED to make sense.

as i understand it, u call a form to dialog mode like this:
DoCmd.OpenForm "frmModClaimOrVariSelector", acNormal, , , , acDialog

and when the user his the ok button the form does a behind the scenes me!visible = false. allowing the code to continue to run until u unload the form.

been running tests with this:


Public Sub TestDialog()
DoCmd.OpenForm "frmModClaimOrVariSelector", acNormal, , , , acDialog
If IsLoaded("frmModClaimOrVariSelector") = True Then
MsgBox "Isloaded"
Else
MsgBox "NotLoaded"
End If
DoCmd.Close acForm, "frmModClaimOrVariSelector"
End Sub

which is supported by this:

Function IsLoaded(ByVal strFormName As String) As Integer
'Returns a 0 if form is not open or a -1 if Open
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
If Forms(strFormName).CurrentView <> 0 Then
IsLoaded = True
End If
End If
End Function

oddly it fails the IsLoaded test everytime. Is my info out of date? does 2007 onwards dialog function differently? seems pretty simple but isn't working...
 
just tried:

If CurrentProject.AllForms("frmModClaimOrVariSelector").IsLoaded = True Then

MsgBox "Isloaded"

Else
MsgBox "NotLoaded"
End If


but STILL no joy. like hitting ok on the dialog closes the form not makes it invisible.
 
The acDialog Window Mode simply sets the form's Modal and PopUp properties to Yes. You could try acHidden?
 
Seems like the link is correct and an important thing to understand.

Your TestDialog code stops with the OpenForm acDialog then continues only when you hit a button and it shuts.

Hence the IsLoaded test will always return False.

Albert Kallal 1, BlueClaw Nil.

(What a joke, BlueClaw put a copyright notice on the command they copied directly from Microsoft.)
 
Actually the effect would be the same if Popup = True halts the code.

BlueClaw 1, Albert Kallal 0

(BlueClaw looses a point for the inappropriate copyright notice so I call it a draw.)
 
ok but the reading i had (see link above) said it stayed open and invisible till unloaded, making the user selection available. riddle me this:

user selects from listbox on custom dialog, hits ok. if code execution stops till the ok button, and the form is dismissed immediately, how can you return the user selection values???
 
user selects from listbox on custom dialog, hits ok. if code execution stops till the ok button, and the form is dismissed immediately, how can you return the user selection values???

Code within the popup continues to run. Just anyhting else is temporarily halted.
 
so ignore my post and just attach stuff to the onclick for ok and cancel or the onclose event. thanks, i'll just do that.
 
My previous post was a supposition.

Maybe Banana will pop in later and tell us what really happens. :D
 
My previous post was a supposition.

Maybe Banana will pop in later and tell us what really happens. :D

*grin* i appreciate your candor. frankly 90% of what i do is supposition but surprisingly goes pretty well - LOL. Hopefully someone can clarify the gritty details at some point...
 
CHAOSinACT;995060. said:
frankly 90% of what i do is supposition but surprisingly goes pretty well -

I think that is true for most of us. I know a lot about what doesn't work.

I call it the Edison method. He said he knew 10,000 way not to make a lightbulb.
 

Users who are viewing this thread

Back
Top Bottom