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
> > > > news
D23F379-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
> > > >
> > > >
> > > >