Re: Close form?
From: Ken Snell [MVP] (kthsneisllis9_at_ncoomcastt.renaetl)
Date: 03/21/05
- Next message: PC Datasheet: "Re: UNDO for unbound control, NOTHING WORKS"
- Previous message: TomU: "RE: Opening another Program & its file"
- In reply to: Tony Williams: "Re: Close form?"
- Next in thread: Tony Williams: "Re: Close form?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 20 Mar 2005 19:14:37 -0500
What is the exact error message and number that you're getting?
--
Ken Snell
<MS ACCESS MVP>
"Tony Williams" <tw@tcpinvalid.com> wrote in message
news:uieLcQTLFHA.2252@TK2MSFTNGP15.phx.gbl...
> Thanks Ken tried that but form still wont close still get the error
> message?
> Tony
> "Ken Snell [MVP]" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
> news:%23La3pHLLFHA.2136@TK2MSFTNGP14.phx.gbl...
>> Why are you using the LostFocus event? That event will not let you reset
> the
>> focus as you wish. If your intent is to capture that the user is trying
>> to
>> leave the control without having entered a value, then use the Exit
>> event,
>> as it can be cancelled and thus keep the focus on the same textbox.
>>
>> Private Sub txtMontha_Exit(Cancel As Integer)
>> On Error GoTo Err_txtMontha_LostFocus
>> Dim MsgStr As String
>> Dim TitleStr As String
>> MsgStr = "You can not enter a record without " _
>> & "completing the Qtr End Date" & vbCrLf & vbCrLf _
>> & "Do You Wish To Go Back " _
>> & "And Enter The Qtr End Date?"
>> TitleStr = "Qtr End Date Must Be Entered"
>> If IsNull(Me!txtMontha) Or Me!txtMontha = "" Then
>> If MsgBox(MsgStr, vbYesNo, TitleStr) = vbYes Then
>> Cancel = True
>> Else
>> Me.Undo
>> DoCmd.Close acForm, Me.Name
>> End If
>> End If
>> Exit_txtMontha_LostFocus:
>> Exit Sub
>>
>> Err_txtMontha_LostFocus:
>> MsgBox Err.Description
>> Resume Exit_txtMontha_LostFocus
>> End Sub
>>
>> --
>>
>> Ken Snell
>> <MS ACCESS MVP>
>>
>>
>>
>> "Tony Williams" <tw@tcpinvalid.com> wrote in message
>> news:uX9g9CLLFHA.1528@TK2MSFTNGP09.phx.gbl...
>> > If the user clicks No in this message I want the form to close, but I
> get
>> > a
>> > message that says This action can't be carried out while processing a
> form
>> > or report.
>> > Here is my code
>> > Private Sub txtMontha_LostFocus()
>> > On Error GoTo Err_txtMontha_LostFocus
>> > Dim MsgStr As String
>> > Dim TitleStr As String
>> > MsgStr = "You can not enter a record without " _
>> > & "completing the Qtr End Date" & vbCrLf & vbCrLf _
>> > & "Do You Wish To Go Back " _
>> > & "And Enter The Qtr End Date?"
>> > TitleStr = "Qtr End Date Must Be Entered"
>> > If IsNull(Me!txtMontha) Or Me!txtMontha = "" Then
>> > If MsgBox(MsgStr, vbYesNo, TitleStr) = vbYes Then
>> > Cancel = True
>> > Me.txtMonthlabela.SetFocus
>> > Me.txtMontha.SetFocus
>> >
>> > Else
>> > Me.Undo
>> > DoCmd.Close acForm, Me.Name
>> > End If
>> > End If
>> > Exit_txtMontha_LostFocus:
>> > Exit Sub
>> >
>> > Err_txtMontha_LostFocus:
>> > MsgBox Err.Description
>> > Resume Exit_txtMontha_LostFocus
>> > End Sub
>> >
>> > Can anyone help?
>> > Thanks
>> > Tony
>> >
>> >
>> >
>>
>>
>
>
- Next message: PC Datasheet: "Re: UNDO for unbound control, NOTHING WORKS"
- Previous message: TomU: "RE: Opening another Program & its file"
- In reply to: Tony Williams: "Re: Close form?"
- Next in thread: Tony Williams: "Re: Close form?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|