469,963 Members | 1,717 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

Runtime Error 3251 Updating not allowed

Run time error 3251 Current Recordset does not support updating, this may be a limitation of the provider, or of the selected Locktype


This is my simple program that will split the entries that have 2 words in it and put it in separate fields:
im using MSaccess for my tables

for example:
before
field1= word1, word2

after:
field1 = word1
field2= word2

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.         Set MyConn = New ADODB.Connection
  3.         MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Thesis\testing\comma\FilipinoDict.mdb;"
  4.         MyConn.Open
  5.  
  6.         Set MyRecSet = MyConn.Execute("SELECT TagWord, EngWord, POS FROM Dictionary ORDER BY TagWord")
  7.         'if myrecset.Fields(0) =
  8.         'for ctr=0 to 50
  9.         ctr = 0
  10.         Do Until MyRecSet.EOF
  11.  
  12.  
  13.         InputSentence.Text = MyRecSet.Fields(0).Value
  14.         wordset = Split(InputSentence.Text, ", ")
  15.  
  16.         If UBound(wordset) > 0 Then
  17.         englishword = MyRecSet.Fields(1)
  18.         For ctr2 = 0 To UBound(wordset)
  19.  
  20.         MyRecSet.Fields(0).Value = wordset(ctr2)
  21.  
  22. ' THE PART WHERE I AM SUPPOSED TO DO THE UPDATING AND ADDING
  23.  
  24.         Next ctr2
  25.  
  26.         End If
  27.         MyRecSet.MoveNext
  28.         Loop
  29.         MyConn.Close
Nov 5 '06 #1
6 9455
Killer42
8,435 Expert 8TB
Before you can change field values, you need to issue an Edit against the record. Then you need to do an Update on it when finished modifying the fields. I didn't read the code carefully though, so may have missed them. Or are they supposed to be in the code where you have the "UPDATING STUFF HERE" type comment?

Which specific statement produces the error?
Nov 5 '06 #2
willakawill
1,646 1GB
Hi, Thanks for posting the code, it helps a lot.
Firstly you might take a shot at changing some of your coding habits. This will help greatly in debugging your code.

When you are accessing recordset fields it is important to identify the field with something other than 0, 1 and 2. You will always have to check back to see what they mean.
Expand|Select|Wrap|Line Numbers
  1. Dim TagWord As Integer
  2. Dim EngWord As Integer
  3. Dim POS As Integer
  4.  
  5. TagWord = 0
  6. EngWord = 1
  7. POS = 2
  8.  
  9. Then
  10. InputSentence.Text = MyRecSet.Fields(0).Value
can read as
Expand|Select|Wrap|Line Numbers
  1. InputSentence.Text = MyRecSet(TagWord)
  2. englishword = MyRecSet(EngWord)
  3.  
  4. With MyRecordset
  5.         .ActiveConnection = MyConn
  6.         .CursorType = adOpenStatic
  7.         .CursorLocation = adUseClient
  8.         .LockType = adLockOptimistic
  9.         .Source = "SELECT TagWord, EngWord, POS FROM Dictionary ORDER BY TagWord"
  10.         .Open
  11. End With
  12.  
Using a recordset this way allows you to set the properties so that you can be sure to be allowed to update it.
Nov 6 '06 #3
Killer42
8,435 Expert 8TB
...
When you are accessing recordset fields it is important to identify the field with something other than 0, 1 and 2. You will always have to check back to see what they mean.
...
TagWord = 0
InputSentence.Text = MyRecSet(TagWord)
...
Interesting. I generally just use the actual field name, rather than the number. For instance
Expand|Select|Wrap|Line Numbers
  1. InputSentence.Text = MyRecSet("TagWord")
Nov 6 '06 #4
Thanks for all the replies, i think i got it working
Nov 8 '06 #5
willakawill
1,646 1GB
Interesting. I generally just use the actual field name, rather than the number. For instance
Expand|Select|Wrap|Line Numbers
  1. InputSentence.Text = MyRecSet("TagWord")
Using the field name as a string is fine if it is not used in a loop or particularly an inner loop because there is an overhead in parsing the string identifier.
Nov 8 '06 #6
Killer42
8,435 Expert 8TB
Using the field name as a string is fine if it is not used in a loop or particularly an inner loop because there is an overhead in parsing the string identifier.
Good point, willakawill - I'll have to keep it in mind in future.

Thanks, I'm always interested in performance tweaks.
Nov 8 '06 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by Frusterated | last post: by
1 post views Thread by Jose4u | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.