PC Review


Reply
Thread Tools Rate Thread

2001 "you cancelled the previous operation"

 
 
Martin Folley
Guest
Posts: n/a
 
      29th Sep 2008
I cannot see the wood for the trees with this error.
The error occurs at Me.Bookmark = rstMe.Bookmark

I am trying to set the contents of a form's list box according to the time
of day when it is opened. I can set the contents and the value of the control
I then call the control's click function to trigger the code that would run
should the control be clicked. This calls the following sub.
I cannot see any 'cancelling'. There is no filter involved on the form.

Any suggestions as to where I should look?

Thanks.

Sub MoveToPupil(lngPupilID As Long)
Dim rstMe As Recordset
Dim bkmkMe As BookmarkEnum

Set rstMe = Me.RecordsetClone
rstMe.FindFirst "[Pupil ID] = " & lngPupilID
If rstMe.NoMatch Then
MsgBox "Pupil ID not found (ID:" & lngPupilID & ")"
Else
Me.Bookmark = rstMe.Bookmark
End If

End Sub
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      29th Sep 2008
Are you certain that the field is, in fact, named Pupil ID (with the space)?
That misleading error message can occur when a name is mistyped.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Martin Folley" <(E-Mail Removed)> wrote in message
newsD23F379-64C9-411E-8B06-(E-Mail Removed)...
>I cannot see the wood for the trees with this error.
> The error occurs at Me.Bookmark = rstMe.Bookmark
>
> I am trying to set the contents of a form's list box according to the time
> of day when it is opened. I can set the contents and the value of the
> control
> I then call the control's click function to trigger the code that would
> run
> should the control be clicked. This calls the following sub.
> I cannot see any 'cancelling'. There is no filter involved on the form.
>
> Any suggestions as to where I should look?
>
> Thanks.
>
> Sub MoveToPupil(lngPupilID As Long)
> Dim rstMe As Recordset
> Dim bkmkMe As BookmarkEnum
>
> Set rstMe = Me.RecordsetClone
> rstMe.FindFirst "[Pupil ID] = " & lngPupilID
> If rstMe.NoMatch Then
> MsgBox "Pupil ID not found (ID:" & lngPupilID & ")"
> Else
> Me.Bookmark = rstMe.Bookmark
> End If
>
> End Sub



 
Reply With Quote
 
Martin Folley
Guest
Posts: n/a
 
      29th Sep 2008
Yes the space is correct, as seems to be the code above.

If I comment out the relevant 'form open' code (so that the from opens using
default values), and click on the list control itself to run the 'click event
code' (part of which is above) then the code behaves normally. It only
appears to crash when the click event code is called as part of another sub
rather than as the result of a physical click.



"Douglas J. Steele" wrote:

> Are you certain that the field is, in fact, named Pupil ID (with the space)?
> That misleading error message can occur when a name is mistyped.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Martin Folley" <(E-Mail Removed)> wrote in message
> newsD23F379-64C9-411E-8B06-(E-Mail Removed)...
> >I cannot see the wood for the trees with this error.
> > The error occurs at Me.Bookmark = rstMe.Bookmark
> >
> > I am trying to set the contents of a form's list box according to the time
> > of day when it is opened. I can set the contents and the value of the
> > control
> > I then call the control's click function to trigger the code that would
> > run
> > should the control be clicked. This calls the following sub.
> > I cannot see any 'cancelling'. There is no filter involved on the form.
> >
> > Any suggestions as to where I should look?
> >
> > Thanks.
> >
> > Sub MoveToPupil(lngPupilID As Long)
> > Dim rstMe As Recordset
> > Dim bkmkMe As BookmarkEnum
> >
> > Set rstMe = Me.RecordsetClone
> > rstMe.FindFirst "[Pupil ID] = " & lngPupilID
> > If rstMe.NoMatch Then
> > MsgBox "Pupil ID not found (ID:" & lngPupilID & ")"
> > Else
> > Me.Bookmark = rstMe.Bookmark
> > End If
> >
> > End Sub

>
>
>

 
Reply With Quote
 
Magius96
Guest
Posts: n/a
 
      29th Sep 2008
Since it works when you actually click on the control, try moving the code
into it's own subroutine then call that subroutine where you need it. You
may be getting the error as a result of calling the OnClick event when there
was no click event.

Of course, my explanation of the error may be wrong, but it's probably the
best way to handle this.

"Martin Folley" wrote:

> Yes the space is correct, as seems to be the code above.
>
> If I comment out the relevant 'form open' code (so that the from opens using
> default values), and click on the list control itself to run the 'click event
> code' (part of which is above) then the code behaves normally. It only
> appears to crash when the click event code is called as part of another sub
> rather than as the result of a physical click.
>
>
>
> "Douglas J. Steele" wrote:
>
> > Are you certain that the field is, in fact, named Pupil ID (with the space)?
> > That misleading error message can occur when a name is mistyped.
> >
> > --
> > Doug Steele, Microsoft Access MVP
> > http://I.Am/DougSteele
> > (no e-mails, please!)
> >
> >
> > "Martin Folley" <(E-Mail Removed)> wrote in message
> > newsD23F379-64C9-411E-8B06-(E-Mail Removed)...
> > >I cannot see the wood for the trees with this error.
> > > The error occurs at Me.Bookmark = rstMe.Bookmark
> > >
> > > I am trying to set the contents of a form's list box according to the time
> > > of day when it is opened. I can set the contents and the value of the
> > > control
> > > I then call the control's click function to trigger the code that would
> > > run
> > > should the control be clicked. This calls the following sub.
> > > I cannot see any 'cancelling'. There is no filter involved on the form.
> > >
> > > Any suggestions as to where I should look?
> > >
> > > Thanks.
> > >
> > > Sub MoveToPupil(lngPupilID As Long)
> > > Dim rstMe As Recordset
> > > Dim bkmkMe As BookmarkEnum
> > >
> > > Set rstMe = Me.RecordsetClone
> > > rstMe.FindFirst "[Pupil ID] = " & lngPupilID
> > > If rstMe.NoMatch Then
> > > MsgBox "Pupil ID not found (ID:" & lngPupilID & ")"
> > > Else
> > > Me.Bookmark = rstMe.Bookmark
> > > End If
> > >
> > > End Sub

> >
> >
> >

 
Reply With Quote
 
Martin Folley
Guest
Posts: n/a
 
      1st Oct 2008
Thanks.
Should have thought of it earlier. Taking out the sub routines and copying
the code into one long sub that appears to do the same has made a difference
(no errors ... yet)


"Magius96" wrote:

> Since it works when you actually click on the control, try moving the code
> into it's own subroutine then call that subroutine where you need it. You
> may be getting the error as a result of calling the OnClick event when there
> was no click event.
>
> Of course, my explanation of the error may be wrong, but it's probably the
> best way to handle this.
>
> "Martin Folley" wrote:
>
> > Yes the space is correct, as seems to be the code above.
> >
> > If I comment out the relevant 'form open' code (so that the from opens using
> > default values), and click on the list control itself to run the 'click event
> > code' (part of which is above) then the code behaves normally. It only
> > appears to crash when the click event code is called as part of another sub
> > rather than as the result of a physical click.
> >
> >
> >
> > "Douglas J. Steele" wrote:
> >
> > > Are you certain that the field is, in fact, named Pupil ID (with the space)?
> > > That misleading error message can occur when a name is mistyped.
> > >
> > > --
> > > Doug Steele, Microsoft Access MVP
> > > http://I.Am/DougSteele
> > > (no e-mails, please!)
> > >
> > >
> > > "Martin Folley" <(E-Mail Removed)> wrote in message
> > > newsD23F379-64C9-411E-8B06-(E-Mail Removed)...
> > > >I cannot see the wood for the trees with this error.
> > > > The error occurs at Me.Bookmark = rstMe.Bookmark
> > > >
> > > > I am trying to set the contents of a form's list box according to the time
> > > > of day when it is opened. I can set the contents and the value of the
> > > > control
> > > > I then call the control's click function to trigger the code that would
> > > > run
> > > > should the control be clicked. This calls the following sub.
> > > > I cannot see any 'cancelling'. There is no filter involved on the form.
> > > >
> > > > Any suggestions as to where I should look?
> > > >
> > > > Thanks.
> > > >
> > > > Sub MoveToPupil(lngPupilID As Long)
> > > > Dim rstMe As Recordset
> > > > Dim bkmkMe As BookmarkEnum
> > > >
> > > > Set rstMe = Me.RecordsetClone
> > > > rstMe.FindFirst "[Pupil ID] = " & lngPupilID
> > > > If rstMe.NoMatch Then
> > > > MsgBox "Pupil ID not found (ID:" & lngPupilID & ")"
> > > > Else
> > > > Me.Bookmark = rstMe.Bookmark
> > > > End If
> > > >
> > > > End Sub
> > >
> > >
> > >

 
Reply With Quote
 
Martin Folley
Guest
Posts: n/a
 
      8th Oct 2008
Arrrgh! it is back

It was working.
Tools repair and compact.
Not working ... operation being cancelled.

Use a break point to stop the code and walk through it ... working.

This implies that it is not a code issue, but possibly a timing issue.

Is there an internal (or hidden) time out used by access to determine
whether a report has stalled?
The report is not that big but it does access 20-30 external jpg files, and
contains about 150 controls.

"Martin Folley" wrote:

> Thanks.
> Should have thought of it earlier. Taking out the sub routines and copying
> the code into one long sub that appears to do the same has made a difference
> (no errors ... yet)
>
>
> "Magius96" wrote:
>
> > Since it works when you actually click on the control, try moving the code
> > into it's own subroutine then call that subroutine where you need it. You
> > may be getting the error as a result of calling the OnClick event when there
> > was no click event.
> >
> > Of course, my explanation of the error may be wrong, but it's probably the
> > best way to handle this.
> >
> > "Martin Folley" wrote:
> >
> > > Yes the space is correct, as seems to be the code above.
> > >
> > > If I comment out the relevant 'form open' code (so that the from opens using
> > > default values), and click on the list control itself to run the 'click event
> > > code' (part of which is above) then the code behaves normally. It only
> > > appears to crash when the click event code is called as part of another sub
> > > rather than as the result of a physical click.
> > >
> > >
> > >
> > > "Douglas J. Steele" wrote:
> > >
> > > > Are you certain that the field is, in fact, named Pupil ID (with the space)?
> > > > That misleading error message can occur when a name is mistyped.
> > > >
> > > > --
> > > > Doug Steele, Microsoft Access MVP
> > > > http://I.Am/DougSteele
> > > > (no e-mails, please!)
> > > >
> > > >
> > > > "Martin Folley" <(E-Mail Removed)> wrote in message
> > > > newsD23F379-64C9-411E-8B06-(E-Mail Removed)...
> > > > >I cannot see the wood for the trees with this error.
> > > > > The error occurs at Me.Bookmark = rstMe.Bookmark
> > > > >
> > > > > I am trying to set the contents of a form's list box according to the time
> > > > > of day when it is opened. I can set the contents and the value of the
> > > > > control
> > > > > I then call the control's click function to trigger the code that would
> > > > > run
> > > > > should the control be clicked. This calls the following sub.
> > > > > I cannot see any 'cancelling'. There is no filter involved on the form.
> > > > >
> > > > > Any suggestions as to where I should look?
> > > > >
> > > > > Thanks.
> > > > >
> > > > > Sub MoveToPupil(lngPupilID As Long)
> > > > > Dim rstMe As Recordset
> > > > > Dim bkmkMe As BookmarkEnum
> > > > >
> > > > > Set rstMe = Me.RecordsetClone
> > > > > rstMe.FindFirst "[Pupil ID] = " & lngPupilID
> > > > > If rstMe.NoMatch Then
> > > > > MsgBox "Pupil ID not found (ID:" & lngPupilID & ")"
> > > > > Else
> > > > > Me.Bookmark = rstMe.Bookmark
> > > > > End If
> > > > >
> > > > > End Sub
> > > >
> > > >
> > > >

 
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
Run time error '2001' You cancelled the previous operation Jack Microsoft Access Form Coding 2 15th Nov 2009 08:40 PM
You Cancelled the previous Operation 2001 Nancy Carol Microsoft Access Form Coding 2 31st Oct 2009 09:53 PM
Error 2001: cancelled previous operation (URGENT!) =?Utf-8?B?c2N1YmFkaXZlcg==?= Microsoft Access 2 12th Sep 2007 02:20 PM
Run-time Error 2001: You cancelled the previous operation Andy Microsoft Access Forms 4 2nd Aug 2005 05:27 PM
Error 2001 You cancelled previous operation problem Jerry Foust via AccessMonster.com Microsoft Access Form Coding 4 10th Jan 2005 09:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:30 PM.