If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Close a form code!
Can i close this form if No seleted.Thanks Bob
If vbNo , DoCmd.Close acForm, "frmZeroAmountHolding" ------------------------------------------------ Private Sub cmdDistributeAllInvoices_Click() DoCmd.OpenForm "frmZeroAmountHolding" Dim nRtnValue As Integer nRtnValue = MsgBox("Are you sure you want to Distribute All Invoices!" & vbCrLf & vbCrLf & "If you choose Yes, all the Invoices will have Invoice Numbers!" & vbCrLf & vbCrLf & "Also have you entered all last Months Payments!", vbCritical + vbYesNo + vbDefaultButton2, "Distribute all Invoices") If nRtnValue = vbYes Then DoCmd.Hourglass True subSetInvoiceValues Application.SysCmd acSysCmdSetStatus, "Process is completed." Application.SysCmd acSysCmdClearStatus DoCmd.Hourglass False Me.lstModify.Requery DoCmd.Close acForm, "frmZeroAmountHolding" End If End Sub -- Thanks in advance for any help with this......Bob MS Access 2007 accdb Windows XP Home Edition Ver 5.1 Service Pack 3 |
#2
|
|||
|
|||
Close a form code!
Sure
Private Sub cmdDistributeAllInvoices_Click() DoCmd.OpenForm "frmZeroAmountHolding" Dim nRtnValue As Integer nRtnValue = MsgBox("Are you sure you want to Distribute All Invoices!" & vbCrLf & vbCrLf & "If you choose Yes, all the Invoices will have Invoice Numbers!" & vbCrLf & vbCrLf & "Also have you entered all last Months Payments!", vbCritical + vbYesNo + vbDefaultButton2, "Distribute all Invoices") If nRtnValue = vbYes Then DoCmd.Hourglass True subSetInvoiceValues Application.SysCmd acSysCmdSetStatus, "Process is completed." Application.SysCmd acSysCmdClearStatus DoCmd.Hourglass False Me.lstModify.Requery DoCmd.Close acForm, "frmZeroAmountHolding" ELSE DoCmd.Close acForm, "frmZeroAmountHolding" End If End Sub Or even simpler, move the End If before the DoCmd.Close acForm line. DoCmd.OpenForm "frmZeroAmountHolding" Dim nRtnValue As Integer nRtnValue = MsgBox("Are you sure you want to Distribute All Invoices!" & vbCrLf & vbCrLf & "If you choose Yes, all the Invoices will have Invoice Numbers!" & vbCrLf & vbCrLf & "Also have you entered all last Months Payments!", vbCritical + vbYesNo + vbDefaultButton2, "Distribute all Invoices") If nRtnValue = vbYes Then DoCmd.Hourglass True subSetInvoiceValues Application.SysCmd acSysCmdSetStatus, "Process is completed." Application.SysCmd acSysCmdClearStatus DoCmd.Hourglass False Me.lstModify.Requery End if DoCmd.Close acForm, "frmZeroAmountHolding" End Sub John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County Bob Vance wrote: Can i close this form if No seleted.Thanks Bob If vbNo , DoCmd.Close acForm, "frmZeroAmountHolding" ------------------------------------------------ Private Sub cmdDistributeAllInvoices_Click() DoCmd.OpenForm "frmZeroAmountHolding" Dim nRtnValue As Integer nRtnValue = MsgBox("Are you sure you want to Distribute All Invoices!" & vbCrLf & vbCrLf & "If you choose Yes, all the Invoices will have Invoice Numbers!" & vbCrLf & vbCrLf & "Also have you entered all last Months Payments!", vbCritical + vbYesNo + vbDefaultButton2, "Distribute all Invoices") If nRtnValue = vbYes Then DoCmd.Hourglass True subSetInvoiceValues Application.SysCmd acSysCmdSetStatus, "Process is completed." Application.SysCmd acSysCmdClearStatus DoCmd.Hourglass False Me.lstModify.Requery DoCmd.Close acForm, "frmZeroAmountHolding" End If End Sub |
#3
|
|||
|
|||
Close a form code!
Thanks John. Brilliant regards Bob Vance
"John Spencer MVP" wrote in message ... Sure Private Sub cmdDistributeAllInvoices_Click() DoCmd.OpenForm "frmZeroAmountHolding" Dim nRtnValue As Integer nRtnValue = MsgBox("Are you sure you want to Distribute All Invoices!" & vbCrLf & vbCrLf & "If you choose Yes, all the Invoices will have Invoice Numbers!" & vbCrLf & vbCrLf & "Also have you entered all last Months Payments!", vbCritical + vbYesNo + vbDefaultButton2, "Distribute all Invoices") If nRtnValue = vbYes Then DoCmd.Hourglass True subSetInvoiceValues Application.SysCmd acSysCmdSetStatus, "Process is completed." Application.SysCmd acSysCmdClearStatus DoCmd.Hourglass False Me.lstModify.Requery DoCmd.Close acForm, "frmZeroAmountHolding" ELSE DoCmd.Close acForm, "frmZeroAmountHolding" End If End Sub Or even simpler, move the End If before the DoCmd.Close acForm line. DoCmd.OpenForm "frmZeroAmountHolding" Dim nRtnValue As Integer nRtnValue = MsgBox("Are you sure you want to Distribute All Invoices!" & vbCrLf & vbCrLf & "If you choose Yes, all the Invoices will have Invoice Numbers!" & vbCrLf & vbCrLf & "Also have you entered all last Months Payments!", vbCritical + vbYesNo + vbDefaultButton2, "Distribute all Invoices") If nRtnValue = vbYes Then DoCmd.Hourglass True subSetInvoiceValues Application.SysCmd acSysCmdSetStatus, "Process is completed." Application.SysCmd acSysCmdClearStatus DoCmd.Hourglass False Me.lstModify.Requery End if DoCmd.Close acForm, "frmZeroAmountHolding" End Sub John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County Bob Vance wrote: Can i close this form if No seleted.Thanks Bob If vbNo , DoCmd.Close acForm, "frmZeroAmountHolding" ------------------------------------------------ Private Sub cmdDistributeAllInvoices_Click() DoCmd.OpenForm "frmZeroAmountHolding" Dim nRtnValue As Integer nRtnValue = MsgBox("Are you sure you want to Distribute All Invoices!" & vbCrLf & vbCrLf & "If you choose Yes, all the Invoices will have Invoice Numbers!" & vbCrLf & vbCrLf & "Also have you entered all last Months Payments!", vbCritical + vbYesNo + vbDefaultButton2, "Distribute all Invoices") If nRtnValue = vbYes Then DoCmd.Hourglass True subSetInvoiceValues Application.SysCmd acSysCmdSetStatus, "Process is completed." Application.SysCmd acSysCmdClearStatus DoCmd.Hourglass False Me.lstModify.Requery DoCmd.Close acForm, "frmZeroAmountHolding" End If End Sub |
Thread Tools | |
Display Modes | |
|
|