D
Dorian
I have a form which I need to popup, collect data from a textbox, then
disappear returning the data to my calling form. I have it all working but
the popup form does not disappear when it is unloaded even when I have
Me.visible = false in the unload event and in the button event which closes
the form. The form is defined as popup=yes, modal=yes. I open the form in
dialog mode to retrieve the data in my application, the form is made
invisible and then closed in the calling form.
Any idea how to make it reliably become invisible before it returns control
to my other form? Access 2003. Here is the code:
Popup form:
Private Function GetUpdateMsg() As String
On Error GoTo ER
DoCmd.OpenForm "frmTicketUpdate", , , , , acDialog
GetUpdateMsg = [Forms]![frmTicketUpdate].[UpdMsg]
DoCmd.Close acForm, "frmTicketUpdate"
Exit Function
ER:
On Error Resume Next
DoCmd.Close acForm, "frmTicketUpdate"
MsgBox Err.Description, , "GetUpdateMsg"
GetUpdateMsg = vbNullString
End Function
Private Sub Form_Load()
Me!UpdMsg = vbNullString
Me!UpdMsg.SetFocus
End Sub
Private Sub butOK_Click()
Me!UpdMsg = Trim(Me!UpdMsg)
Me.Visible = False
Me.Repaint
End Sub
Private Sub butCancel_Click()
Me!UpdMsg = vbNullString
Me.Visible = False
Me.Repaint
End Sub
Private Sub Form_Unload(Cancel As Integer)
Me.Visible = False
Me.Repaint
End Sub
Calling form:
disappear returning the data to my calling form. I have it all working but
the popup form does not disappear when it is unloaded even when I have
Me.visible = false in the unload event and in the button event which closes
the form. The form is defined as popup=yes, modal=yes. I open the form in
dialog mode to retrieve the data in my application, the form is made
invisible and then closed in the calling form.
Any idea how to make it reliably become invisible before it returns control
to my other form? Access 2003. Here is the code:
Popup form:
Private Function GetUpdateMsg() As String
On Error GoTo ER
DoCmd.OpenForm "frmTicketUpdate", , , , , acDialog
GetUpdateMsg = [Forms]![frmTicketUpdate].[UpdMsg]
DoCmd.Close acForm, "frmTicketUpdate"
Exit Function
ER:
On Error Resume Next
DoCmd.Close acForm, "frmTicketUpdate"
MsgBox Err.Description, , "GetUpdateMsg"
GetUpdateMsg = vbNullString
End Function
Private Sub Form_Load()
Me!UpdMsg = vbNullString
Me!UpdMsg.SetFocus
End Sub
Private Sub butOK_Click()
Me!UpdMsg = Trim(Me!UpdMsg)
Me.Visible = False
Me.Repaint
End Sub
Private Sub butCancel_Click()
Me!UpdMsg = vbNullString
Me.Visible = False
Me.Repaint
End Sub
Private Sub Form_Unload(Cancel As Integer)
Me.Visible = False
Me.Repaint
End Sub
Calling form: