Hide, Show, Load... (Form CallBack)


I'm sure this is easier than I think, but the helpfile seemed a bit obtuse. I'm in frmA stepping through a recordset and I need, on ocasion, to pop up frmB, give the user some choices and get a response from them (an option > group) and then return that response to frmA's procedure. It seemed the easy way to do that would be to LOAD frmB, SHOW it when I need a response, HIDE it when I get the response (but I should still be able to access the value of the options group via Forms!, shouldn't I?), and then UNLOAD it when done. Would someone be kind enough to send me code snippets to illustrate how to do these things (and, I'm assuming the code would be run in procedures on frmA - right?)



Here is the one (not the best one probably) of the dozen of possible solutions:

Dim mfrmB As Form

Private Sub cmdFrmBShow_Click()
    Set mfrmB = New Form_frmB
    mfrmB.Show Me
End Sub

Public Sub CallBack()
    '*+ get values from mfrmB here
    '*- get values from mfrmB here
    Set mfrmB = Nothing
End Sub

frmB's code:

Private mfrmCalledBy As Form

Public Sub Show(ByRef rfrm As Form)
    Set mfrmCalledBy = rfrm
    Me.Visible = True
End Sub

Private Sub cmdOk_Click()
    Me.Visible = False
End Sub

Copyright 1999-2008 by Shamil Salakhetdinov. All rights reserved.