dbTalk Databases Forums  

Help! VB in access form, with error when using ADO to update

comp.database.ms-access comp.database.ms-access


Discuss Help! VB in access form, with error when using ADO to update in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
KF
 
Posts: n/a

Default Help! VB in access form, with error when using ADO to update - 09-09-2003 , 12:35 AM






Hi:

In an ms-access form, I wrote some code on doublick of a listbox to
process data, and then call a save subroutine to store updated fields
to a table. It seems to save successfully when I open the table to
check. However, when I
single-click on the same list again right after it saved (or
single-click on another listbox on the same page which queries from a
totally different table), it produces a strange message: "The data has
been changed. Another user edited theis record and saved the changes
before you attempted to save your changes. Re-edit the record."

Why is this?

Thanks,
Kenneth

here is an excerpt from the save sub:

Private Sub SaveContent (Num)
Dim ad as ADODB.Recordset
Dim ad = New ADODB.Recordset
For I = 1 to Num
Text = Text & TextVar (I)
Next
ad.Open "A1Database", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
ad.MoveFirst
ad.Find "ID=" & ID
ad!Name = Text
ad.Update
ad.Close

End sub

Reply With Quote
  #2  
Old   
Chris
 
Posts: n/a

Default Re: Help! VB in access form, with error when using ADO to update - 09-13-2003 , 07:16 PM






I had exact same problem--never did figure out why but I read somewhere that
this could occur if your table has a Memo field that you're updating with
Save. I took out Memo field (Notes) & put in a sep. Table & problem never
came up. Don't really understand why but it worked so I pass that on..

"KF" <kennethpf (AT) hotmail (DOT) com> wrote

Quote:
Hi:

In an ms-access form, I wrote some code on doublick of a listbox to
process data, and then call a save subroutine to store updated fields
to a table. It seems to save successfully when I open the table to
check. However, when I
single-click on the same list again right after it saved (or
single-click on another listbox on the same page which queries from a
totally different table), it produces a strange message: "The data has
been changed. Another user edited theis record and saved the changes
before you attempted to save your changes. Re-edit the record."

Why is this?

Thanks,
Kenneth

here is an excerpt from the save sub:

Private Sub SaveContent (Num)
Dim ad as ADODB.Recordset
Dim ad = New ADODB.Recordset
For I = 1 to Num
Text = Text & TextVar (I)
Next
ad.Open "A1Database", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
ad.MoveFirst
ad.Find "ID=" & ID
ad!Name = Text
ad.Update
ad.Close

End sub



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.