Error 2001, Access 2007, Subform Bookmark

  • Thread starter Jose Antonio Vial
  • Start date
J

Jose Antonio Vial

I´ve problems to synchronize subforms with access 2007. Runnig the same old
code that worked with Acess 2003:

Dim int As Integer
Dim rst As Dao.Recordset
int=Me.[ID]
Set rst = Forms![mainform]![subform].Form.RecordsetClone
rst.FindFirst "[ID]=" & int
Forms![mainform]![subform].Form.Bookmark = rst.Bookmark

Now, with Acces 2007, I get a runtime error 2001, "You canceled the previous
operation".

I ´d like to know how to solve this problem or another way to synchronize
subforms with Acess 2007.
 
J

Jeanette Cunningham

Hi Jose,

runtime error 2001, "You canceled the previous operation".
is Access's way of telling you that it could not find a match using
FindFirst.

When you use FindFirst, you must always test for NoMatch before you set the
bookmark, like this-->

rst.FindFirst "[ID]=" & int
If Not rst.NoMatch Then
Forms![mainform]![subform].Form.Bookmark = rst.Bookmark
End If



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

Jose Antonio Vial

Hi Jeannette, and thanks for your help!, but the problem remains.

I do what you tell me, but the code is still sending me the same error...I
think the "FindFist" sentenece is workig good, becouse the message error
appears later on the code, just on the "bookmark" sentence.

I´m affraid that the problem is trying to synchronize a form with a subform,
but the strange thing is that it used to work with Access 2003 and now, with
Access 2007 it doesn´t work anymore...


Jeanette Cunningham said:
Hi Jose,

runtime error 2001, "You canceled the previous operation".
is Access's way of telling you that it could not find a match using
FindFirst.

When you use FindFirst, you must always test for NoMatch before you set the
bookmark, like this-->

rst.FindFirst "[ID]=" & int
If Not rst.NoMatch Then
Forms![mainform]![subform].Form.Bookmark = rst.Bookmark
End If



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Jose Antonio Vial said:
I´ve problems to synchronize subforms with access 2007. Runnig the same
old
code that worked with Acess 2003:

Dim int As Integer
Dim rst As Dao.Recordset
int=Me.[ID]
Set rst = Forms![mainform]![subform].Form.RecordsetClone
rst.FindFirst "[ID]=" & int
Forms![mainform]![subform].Form.Bookmark = rst.Bookmark

Now, with Acces 2007, I get a runtime error 2001, "You canceled the
previous
operation".

I ´d like to know how to solve this problem or another way to synchronize
subforms with Acess 2007.


.
 
J

Jeanette Cunningham

Assuming that the combo is on the main form and the link master and link
child fields are set up correctly,
the following code should do what you want.


rst.FindFirst "[ID]=" & int
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Jose Antonio Vial said:
Hi Jeannette, and thanks for your help!, but the problem remains.

I do what you tell me, but the code is still sending me the same error...I
think the "FindFist" sentenece is workig good, becouse the message error
appears later on the code, just on the "bookmark" sentence.

I´m affraid that the problem is trying to synchronize a form with a
subform,
but the strange thing is that it used to work with Access 2003 and now,
with
Access 2007 it doesn´t work anymore...


Jeanette Cunningham said:
Hi Jose,

runtime error 2001, "You canceled the previous operation".
is Access's way of telling you that it could not find a match using
FindFirst.

When you use FindFirst, you must always test for NoMatch before you set
the
bookmark, like this-->

rst.FindFirst "[ID]=" & int
If Not rst.NoMatch Then
Forms![mainform]![subform].Form.Bookmark = rst.Bookmark
End If



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

in
message news:[email protected]...
I´ve problems to synchronize subforms with access 2007. Runnig the same
old
code that worked with Acess 2003:

Dim int As Integer
Dim rst As Dao.Recordset
int=Me.[ID]
Set rst = Forms![mainform]![subform].Form.RecordsetClone
rst.FindFirst "[ID]=" & int
Forms![mainform]![subform].Form.Bookmark = rst.Bookmark

Now, with Acces 2007, I get a runtime error 2001, "You canceled the
previous
operation".

I ´d like to know how to solve this problem or another way to
synchronize
subforms with Acess 2007.


.
 
J

Jose Antonio Vial

Thank you again Jeannette.

But this code you send to me works well when you are dealing with the main
form and its combos; actually, I have other forms in my program syncronized
in that way and they work perfectly.

The problem, in this case, is that I´m trying to synchronize the records of
a subform, so, as I´d learned once and it used to work before I change to
Office 2007, the sentence should be:

rst.FindFirst "[ID]=" & int
If Not rst.NoMatch Then
Me!subform.form.Bookmark = rst.Bookmark
End If

But, as I tell you before, for a strange reason I´m trying to find out, this
is not working anymore...

Jeanette Cunningham said:
Assuming that the combo is on the main form and the link master and link
child fields are set up correctly,
the following code should do what you want.


rst.FindFirst "[ID]=" & int
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Jose Antonio Vial said:
Hi Jeannette, and thanks for your help!, but the problem remains.

I do what you tell me, but the code is still sending me the same error...I
think the "FindFist" sentenece is workig good, becouse the message error
appears later on the code, just on the "bookmark" sentence.

I´m affraid that the problem is trying to synchronize a form with a
subform,
but the strange thing is that it used to work with Access 2003 and now,
with
Access 2007 it doesn´t work anymore...


Jeanette Cunningham said:
Hi Jose,

runtime error 2001, "You canceled the previous operation".
is Access's way of telling you that it could not find a match using
FindFirst.

When you use FindFirst, you must always test for NoMatch before you set
the
bookmark, like this-->

rst.FindFirst "[ID]=" & int
If Not rst.NoMatch Then
Forms![mainform]![subform].Form.Bookmark = rst.Bookmark
End If



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

in
message I´ve problems to synchronize subforms with access 2007. Runnig the same
old
code that worked with Acess 2003:

Dim int As Integer
Dim rst As Dao.Recordset
int=Me.[ID]
Set rst = Forms![mainform]![subform].Form.RecordsetClone
rst.FindFirst "[ID]=" & int
Forms![mainform]![subform].Form.Bookmark = rst.Bookmark

Now, with Acces 2007, I get a runtime error 2001, "You canceled the
previous
operation".

I ´d like to know how to solve this problem or another way to
synchronize
subforms with Acess 2007.


.



.
 
J

Jeanette Cunningham

To make this code work easily
1. the combo does a find first on the main form
2. this makes the main form move to show only records with the same ID as
the record selected in the combo.
3. this makes the subform move to show only those records which have the
matching ID with the main form

If the above won't work for you in this case,
would you post the name of the table, its Primary Key for both main form and
subform.
For the subform its foreign key as well as the relationship between the
tables.

Is the combo doing a find first on the primary key of the main form?


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Jose Antonio Vial said:
Thank you again Jeannette.

But this code you send to me works well when you are dealing with the main
form and its combos; actually, I have other forms in my program
syncronized
in that way and they work perfectly.

The problem, in this case, is that I´m trying to synchronize the records
of
a subform, so, as I´d learned once and it used to work before I change to
Office 2007, the sentence should be:

rst.FindFirst "[ID]=" & int
If Not rst.NoMatch Then
Me!subform.form.Bookmark = rst.Bookmark
End If

But, as I tell you before, for a strange reason I´m trying to find out,
this
is not working anymore...

Jeanette Cunningham said:
Assuming that the combo is on the main form and the link master and link
child fields are set up correctly,
the following code should do what you want.


rst.FindFirst "[ID]=" & int
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Jose Antonio Vial said:
Hi Jeannette, and thanks for your help!, but the problem remains.

I do what you tell me, but the code is still sending me the same
error...I
think the "FindFist" sentenece is workig good, becouse the message
error
appears later on the code, just on the "bookmark" sentence.

I´m affraid that the problem is trying to synchronize a form with a
subform,
but the strange thing is that it used to work with Access 2003 and now,
with
Access 2007 it doesn´t work anymore...


:

Hi Jose,

runtime error 2001, "You canceled the previous operation".
is Access's way of telling you that it could not find a match using
FindFirst.

When you use FindFirst, you must always test for NoMatch before you
set
the
bookmark, like this-->

rst.FindFirst "[ID]=" & int
If Not rst.NoMatch Then
Forms![mainform]![subform].Form.Bookmark = rst.Bookmark
End If



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Jose Antonio Vial" <Jose Antonio (e-mail address removed)>
wrote
in
message I´ve problems to synchronize subforms with access 2007. Runnig the
same
old
code that worked with Acess 2003:

Dim int As Integer
Dim rst As Dao.Recordset
int=Me.[ID]
Set rst = Forms![mainform]![subform].Form.RecordsetClone
rst.FindFirst "[ID]=" & int
Forms![mainform]![subform].Form.Bookmark = rst.Bookmark

Now, with Acces 2007, I get a runtime error 2001, "You canceled the
previous
operation".

I ´d like to know how to solve this problem or another way to
synchronize
subforms with Acess 2007.


.



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top