PC Review


Reply
Thread Tools Rate Thread

DoCOM Close question

 
 
PowerPoint Jedi
Guest
Posts: n/a
 
      10th Sep 2008
Well I am back for more help, sorry just can't seem to figure it out

First I am using Access 2003 and VB 6.5

I wrote this private subroutine and for some reason seem to get a runtime
error. I want this sub routine to check is the closed field is "yes" if it
is it should run specified macro. This portion of the subroutine works. If
not yes I want it to close the form. This is what I wrote

Private Sub Form_Close()
If Forms![ERGR]![Closed] = "yes" Then
DoCmd.RunMacro "Transfer Closed ERGR", 1
Else
DoCmd.Close acForm, "ERGR", acSaveYes
End If
End Sub

When I close the form with the [clised] field a null I get a prompt asking
me if I want to save the changes (which I dont want to get, it SHOULD
automatically save) and this message
Run-time error 2501
the close action was canceled


Any clues as to what I did wrong. All I really want is it to check for yes
if not yes - save and close form
if yes run macro

Thanks for any help given.

 
Reply With Quote
 
 
 
 
PowerPoint Jedi
Guest
Posts: n/a
 
      11th Sep 2008
Issue resolved

"PowerPoint Jedi" wrote:

> Well I am back for more help, sorry just can't seem to figure it out
>
> First I am using Access 2003 and VB 6.5
>
> I wrote this private subroutine and for some reason seem to get a runtime
> error. I want this sub routine to check is the closed field is "yes" if it
> is it should run specified macro. This portion of the subroutine works. If
> not yes I want it to close the form. This is what I wrote
>
> Private Sub Form_Close()
> If Forms![ERGR]![Closed] = "yes" Then
> DoCmd.RunMacro "Transfer Closed ERGR", 1
> Else
> DoCmd.Close acForm, "ERGR", acSaveYes
> End If
> End Sub
>
> When I close the form with the [clised] field a null I get a prompt asking
> me if I want to save the changes (which I dont want to get, it SHOULD
> automatically save) and this message
> Run-time error 2501
> the close action was canceled
>
>
> Any clues as to what I did wrong. All I really want is it to check for yes
> if not yes - save and close form
> if yes run macro
>
> Thanks for any help given.
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ThisWorkbook.Close question Robert Crandal Microsoft Excel Programming 2 24th Jan 2010 01:38 PM
Question on Close =?Utf-8?B?dnZlbms=?= Microsoft VB .NET 0 18th Jul 2005 10:19 PM
Question on SqlDataReader.Close Microsoft ADO .NET 5 4th May 2005 06:45 AM
Close question Woody Splawn Microsoft VB .NET 3 6th Feb 2004 02:13 AM
Me.Close() Question Alice Microsoft VB .NET 7 8th Dec 2003 09:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:54 PM.