Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / September 2007

Tip: Looking for answers? Try searching our database.

Error 2115 - but not 'before update' ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martin Folley - 17 Jul 2007 15:04 GMT
I am trying to move between records with the following code (in the AFTERT
Update event of a listbox):

Set rstMe = Me.RecordsetClone
rstMe.FindFirst "[Pupil ID] = " & Me!LstReqdPupil.ItemData(0)
If rstMe.NoMatch Then
   MsgBox "Pupil ID not found when changing year group"
   Else
   Me.Bookmark = rstMe.Bookmark
   End If

This raises the run-time error 2115 when it reaches the line 'Me.Bookmark =
rstMe.Bookmark'.

I am selecting from a listbox (LstReqdPupil) which is not linked to the
underlying data, this occurs even when no other controls change any data, and
when the are no 'before update' events used anywhere in the project.

Any suggestions where I should look for the problem?

Thanks.
Allen Browne - 17 Jul 2007 15:27 GMT
Access has to save the record before it can move to another one. Try
explicitly saving before the other code, e.g.:
   If Me.Dirty Then Me.Dirty = False

My guess is that this will fail (saying the property can't be set), which
indicates that the current record cannot be saved. You must fix the problem
before you can move on.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I am trying to move between records with the following code (in the AFTERT
> Update event of a listbox):
[quoted text clipped - 19 lines]
>
> Thanks.
Martin Folley - 04 Sep 2007 13:06 GMT
Thanks for the reply, school hols are now over and it is back to work :-(

the immediate window reports me.dirty as already being false, which kind of
implies that no data has changed (which matches the reality as I see it).

The error message actually says ...
'The macro or function set to the BeforeUpdate or ValidationRule property
for this field is preventing Microsoft Office Access from saving the data in
the field'.

The error occurs when I am setting Me.Bookmark. Me.Name gives the name of
the form itself rather than a field. Is there a way to determine which
'field' the error message applies to?

> Access has to save the record before it can move to another one. Try
> explicitly saving before the other code, e.g.:
[quoted text clipped - 27 lines]
> >
> > Thanks.
Martin Folley - 18 Sep 2007 12:26 GMT
I never managed to solve this one but compromised on how the form works.

It seems that I can use a click event on one unbound list box to change and
select different options in other unbound list boxes in a sort of cascade of
options, but that I cannot then move the underlying record based on these
changes. The final list box in the series must be clicked to move records, I
cannot do it via vba, even if no bound data has been changed at any point.

> Thanks for the reply, school hols are now over and it is back to work :-(
>
[quoted text clipped - 41 lines]
> > >
> > > Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.