Question : Change WindowMode from acHidden to acDialog after opening it

I need to open a form as follows:
    stDocName = "PostCodeSearch"
    DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog
Make some change as follows:
    Forms.PostCodeSearch.PCArea = strSelectedText
    Forms.PostCodeSearch.Town = ""
    Forms.PostCodeSearch.Street.SetFocus

Then change its WindowsMode to acDialog so that the code in the calling module waits for the form 'PostCodeSearch' to close as if I had originally opened it acDialog.

Code being used
------------------------------------------------------------
Private Sub PCCearch_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PostCodeSearch"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acHidden
If Nz(strSelectedText, "") <> "" Then  
    Forms.PostCodeSearch.PCArea = strSelectedText
    Forms.PostCodeSearch.Town = ""
    Forms.PostCodeSearch.Street.SetFocus
End If
Forms.PostCodeSearch.Visible = True
'Wait here for the 'PostCodeSearch' form to close and return control here
End Sub


Thanks

Answer : Change WindowMode from acHidden to acDialog after opening it

You can't.
A window is opened in dialog mode - if it isn't you can't then change that.

You either close it and open it again - or only open it in dialog mode from the outset.

The reason you're wanting to - is because you want to set certain values in the form.  i.e. you're pushing values in.
The way to do that in fact is to pull them.
The dialog form sets the values itself when it opens.

How you acomplish that varies (there are many alternatives).
Global variables is probably the easiest method.
Random Solutions  
 
programming4us programming4us