views:

28

answers:

2

Hi there, thanks in advance for any help

I am trying to figure out how to make pop-up sub form the only available focus for a user in a database. So that the user is essentially forced to complete/save/close the sub form, before they can return to the parent form. This I imagine involves disabling the parent form and trying to keep it at the bottom of the pile so to speak.

Im trying to do this in vba as a public subroutine, unfortunately I'm not getting very far! It would seem to me that this type of functionality would be quite common place when pop up forms are used, am I overlooking a common feature?

Any guidance would be greatly appreciated.

Cheers

Noel

+2  A: 

Very simple:
DoCmd.OpenForm kfrmArt,acNormal,,,,acDialog
This will stop all processing the next lines until your form closes.

iDevlop
Great Patrick, exactly what I was after
glinch
A: 

You can also set the form's modal property to true. Here is documentation on it: http://msdn.microsoft.com/en-us/library/aa195316(office.10).aspx

Fink
This does not pause code, though, and it has some other side effects that opening with acDialog do not. For what it's worth, I've been programming in Access since 1996 and don't ever set the Modal property to TRUE -- I can do everything I need with opening forms with the acDialog parameter.
David-W-Fenton
When you are calling it to use the acDialog command behind the scenes it sets the modal property to true and the pop-up property to true. from MSDN article: "Note You can use the Dialog setting of the Window Mode action argument of the OpenForm action to open a form with its Modal and PopUp properties set to Yes."
Fink
David-W-Fenton
when you poll those properties they will return the value that you have set for the form originally. calling it with acDialog will not change those values. I can agree with that. its not impossible to code a form that doesn't use acDialog as its window mode is all I'm saying.
Fink
Using the Modal and Popup properties without the acDialog parameter does not behave the same as using acDialog with neither. You seem to be suggesting that they are equivalent, but they are not.
David-W-Fenton
acDialog stops the code in addition to being modal and popup. fact is proven. Its also true that calling openform with acDialog will not change the modal or popup properties when you prompt for them at run-time. what i'm suggesting is that there are alternative ways to code a dialog box.
Fink