gemma-the-husky
07-03-2011, 01:57 AM
I prefer not to use dialog mode with forms. I like sizeable and movable forms, and in many of my apps, I save form sizes and positions, so that uses can get the interface looking how they want.
So here is an alternative
open form with this code. Access will now wait for the form to close before continuing - which is the the same as dialog mode, but you now have a "normal" form appearance
docmd.openform "myform"
while isopen("myform")
doevents
wend
.... waits for form to close
.... program execution continues
now the trouble is, there is no isopen function in vba - so this does the job.
Function IsOpen(strName As String, Optional objtype As Integer = acForm)
IsOpen = (SysCmd(acSysCmdGetObjectState, objtype, strName) <> 0)
End Function
note that you can use this idea with a query, or a report also
docmd.openform "myreport"
while isopen("myreport",acreport)
doevents
wend
So here is an alternative
open form with this code. Access will now wait for the form to close before continuing - which is the the same as dialog mode, but you now have a "normal" form appearance
docmd.openform "myform"
while isopen("myform")
doevents
wend
.... waits for form to close
.... program execution continues
now the trouble is, there is no isopen function in vba - so this does the job.
Function IsOpen(strName As String, Optional objtype As Integer = acForm)
IsOpen = (SysCmd(acSysCmdGetObjectState, objtype, strName) <> 0)
End Function
note that you can use this idea with a query, or a report also
docmd.openform "myreport"
while isopen("myreport",acreport)
doevents
wend