How to move to the next record? 
Author Message
 How to move to the next record?

Hi, friends,

I would like to solve this problem.

Say, I have a form showing the records of a query. Now, if the user select a
field in the form, and change it, the same value has to be replaced in the
next record of the corresponding field. I solved the problem capturing the
afterupdate event of the textbox involved, writing a simple procedure, one
for every field

The procedure looks like this, for the Referer Field:

Private Sub Referer_AfterUpdate()
Dim fldReferer As String
fldReferer = Me!Referer.Text
DoCmd.GoToRecord acDataForm, Me.Name, acNext, 1
Me!Referer.Text = fldReferer
End Sub

But when I change the value of the field in a record, I get as error
message: I can't save data in the fields because of the property
"BeforeUpdate"

But I have no "BeforeUpdate" procedure.

Anyway, I choose to end, and the changes are applied to the next record,
getting newly the same message, for the next record.

Amy help?

Francesco



Mon, 20 Jun 2005 15:40:44 GMT  
 How to move to the next record?
Hi Francesco,

try this other way

Private Sub Referer_AfterUpdate()
Dim rst As DAO.Recordset

  Set rst = Me.RecordsetClone
  rst.AbsolutePosition = rst.AbsolutePosition + 1
  rst.Edit
  rst!Referer = Me.Referer
  rst.Update
  Me.Bookmark = rst.Bookmark
  Set rst = Nothing

En Sub

--
Saludos desde Barcelona
Juan M. Afan de Ribera



Quote:
> Hi, friends,

> I would like to solve this problem.

> Say, I have a form showing the records of a query. Now, if the user select
a
> field in the form, and change it, the same value has to be replaced in the
> next record of the corresponding field. I solved the problem capturing the
> afterupdate event of the textbox involved, writing a simple procedure, one
> for every field

> The procedure looks like this, for the Referer Field:

> Private Sub Referer_AfterUpdate()
> Dim fldReferer As String
> fldReferer = Me!Referer.Text
> DoCmd.GoToRecord acDataForm, Me.Name, acNext, 1
> Me!Referer.Text = fldReferer
> End Sub

> But when I change the value of the field in a record, I get as error
> message: I can't save data in the fields because of the property
> "BeforeUpdate"

> But I have no "BeforeUpdate" procedure.

> Anyway, I choose to end, and the changes are applied to the next record,
> getting newly the same message, for the next record.

> Amy help?

> Francesco



Mon, 20 Jun 2005 17:11:11 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Disable move to prev/next record when turning mouse wheel

2. How to move to the next record

3. How to move to the next record?

4. Disconnected Recordset will not move to the next record

5. How to make combo box move to next record

6. Doing Error Checking before moving to next record

7. Move next takes user to new record - not wanted

8. Move Next Record

9. Data control will not refresh/move to next record

10. Move to next record in DAO

11. Move Next or move previous

12. Enter,Next Row and Clear for Next record

 

 
Powered by phpBB® Forum Software