A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Close a form code!



 
 
Thread Tools Display Modes
  #1  
Old May 5th, 2009, 07:50 AM posted to microsoft.public.access
Bob Vance
external usenet poster
 
Posts: 726
Default 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  
Old May 5th, 2009, 03:28 PM posted to microsoft.public.access
John Spencer MVP
external usenet poster
 
Posts: 533
Default 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  
Old May 5th, 2009, 10:55 PM posted to microsoft.public.access
Bob Vance
external usenet poster
 
Posts: 726
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:10 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.