Close Open Form on Open New

scouser

Registered User.
Local time
Today, 11:17
Joined
Nov 25, 2003
Messages
767
Hi to all. I have the code below that opens frmSalesOrders when clicked from frmCustomers. I have other buttons that utilize code DoCmd.Close acForm, Me.Name and they function as required. In this instance frmCustomers remains open behind the form called frmSalesOrders.

Private Sub OrderID_Click()
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "frmSalesOrders", , , "OrderID = " & OrderID.Value
End Sub

Am I missing something obvious?
Thanks,
Phil.
 
I have put the following in the On_Load of frmSalesOrders. It works as required.

DoCmd.Close acForm, "frmCustomers"

Phil.
 
I would have thought your code would work. Is the second form modal maybe?
 
I would have expected your code to fail since you reference the value of a member of that form after you've closed it.
 
Hi. The form is not set to Modal. It is now working as previously stated. Thaks for taking time to review.
Phil
 

Users who are viewing this thread

Back
Top Bottom