Form wont close

TTSKevin

New member
Local time
Today, 15:13
Joined
Nov 23, 2009
Messages
5
Hi.

I got a db, and in short, when clicking a button a second form opens in dialog to add data.

There is a couple of combo boxes where the notinlist event opens a second form in dialog to add data to the table for the combo. Im using the openform command with the acDialog property.

When i click ok in this second formdialog to save and close (using embedded macro) the second form moves behind the first one, but will not colse completely until i exit the first combo.

Everything else seems to be working, but the form stays open, and this annoys me to death.

Thanks
Kevin
 
I find it best to only have ONE form opened and visible in dialog mode.

Try hiding ( .Visible = No) the first dialog form before opening the second dialog form. After the second dialog from closes, make the first one visible again.

Example:

Me.Visible = False
Docmd.Openform .... ' open another form in dialog mode
Me.Visible = True
 
Thanks, but it does not work.
The form stays visible.

Heres my code for the notinlist event of the combo in the first dialog:

_________
Private Sub Customer_NotInList(NewData As String, Response As Integer)

On Error GoTo ErrorHandler

If MsgBox("The customer " & Chr(34) & NewData & _
Chr(34) & " is not currently listed." & vbCrLf & _
"Would you like to add it to the list now?", _
vbQuestion + vbYesNo) = vbYes Then

Me.Visible = False
DoCmd.OpenForm "Administrator_Customers_Add_Dialog", , , , acFormAdd, acDialog, NewData
Response = acDataErrAdded
Me.Visible = True

Else
MsgBox "Please choose a customer from the list." _
, vbInformation, "Not in list"
Response = acDataErrContinue

End If
Customer_NotInList_Exit:

Exit Sub

ErrorHandler:
MsgBox "Error #: " & Err.Number & vbCrLf & vbCrLf & Err.Description
Resume Customer_NotInList_Exit

End Sub
_________________

Thanks,
Kevin
 

Users who are viewing this thread

Back
Top Bottom