473,467 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Current Recrdset does not support updating

134 New Member
I got this Run-time error 3251

Current Recrdset does not support updating. This may be limation of the provider, or of the selected locktype.


Dim red1 As New ADODB.Recordset
Dim strmess As String

Set cnp = CurrentProject.Connection
strmess = "SELECT * from tblinvoicelines WHERE invoice=" & newInvo
Set red1 = cnp.Execute(strmess)

If Not red1.EOF Then
red1.MoveFirst
Do While Not red1.EOF
If red1!Invoice = newInvo Then
red1.Fields("amount") = Round(red1!Qty_Order * red1!Sell_price, 2)
red1.Update

End If
red1.MoveNext
Loop

End If

How can I resolve this, why MS Access does allow this simple updating ?
Dec 23 '06 #1
8 7464
sashi
1,754 Recognized Expert Top Contributor
I got this Run-time error 3251

Current Recrdset does not support updating. This may be limation of the provider, or of the selected locktype.


Dim red1 As New ADODB.Recordset
Dim strmess As String

Set cnp = CurrentProject.Connection
strmess = "SELECT * from tblinvoicelines WHERE invoice=" & newInvo
Set red1 = cnp.Execute(strmess)

If Not red1.EOF Then
red1.MoveFirst
Do While Not red1.EOF
If red1!Invoice = newInvo Then
red1.Fields("amount") = Round(red1!Qty_Order * red1!Sell_price, 2)
red1.Update

End If
red1.MoveNext
Loop

End If

How can I resolve this, why MS Access does allow this simple updating ?
Hi there,

Kindly refer to below modified code segment, hope it helps. Good luck & Take care.

Expand|Select|Wrap|Line Numbers
  1.   strmess = ""
  2.   strmess = "SELECT * from tblinvoicelines  WHERE invoice=" & newInvo
  3.   red1.Open strmess, CurrentProject.Connection, _
  4.             adOpenKeyset, adLockOptimistic
  5.  
Dec 23 '06 #2
ADezii
8,834 Recognized Expert Expert
I got this Run-time error 3251

Current Recrdset does not support updating. This may be limation of the provider, or of the selected locktype.


Dim red1 As New ADODB.Recordset
Dim strmess As String

Set cnp = CurrentProject.Connection
strmess = "SELECT * from tblinvoicelines WHERE invoice=" & newInvo
Set red1 = cnp.Execute(strmess)

If Not red1.EOF Then
red1.MoveFirst
Do While Not red1.EOF
If red1!Invoice = newInvo Then
red1.Fields("amount") = Round(red1!Qty_Order * red1!Sell_price, 2)
red1.Update

End If
red1.MoveNext
Loop

End If

How can I resolve this, why MS Access does allow this simple updating ?
If I am not mistaken, and unless otherwise specified, isn't the Default ADO
Recordset Read Only..
Dec 23 '06 #3
sashi
1,754 Recognized Expert Top Contributor
If I am not mistaken, and unless otherwise specified, isn't the Default ADO
Recordset Read Only..
Hi there,

Yes, the default locktype is set to adLockReadOnly. This property is set to read/write on a closed recordset and read-only on an open recordset. Take care.
Dec 24 '06 #4
jamesnkk
134 New Member
Hi there,

Kindly refer to below modified code segment, hope it helps. Good luck & Take care.

Expand|Select|Wrap|Line Numbers
  1.   strmess = ""
  2.   strmess = "SELECT * from tblinvoicelines  WHERE invoice=" & newInvo
  3.   red1.Open strmess, CurrentProject.Connection, _
  4.             adOpenKeyset, adLockOptimistic
  5.  
I copy your statement, I got an error message - Run time error - 3705
Operation is not allowed when the object is open.
Dec 24 '06 #5
willakawill
1,646 Top Contributor
I copy your statement, I got an error message - Run time error - 3705
Operation is not allowed when the object is open.
that is because you have already opened the recordset earlier in your code.
insert this just before the code that you posted above:
red1.Close
Dec 24 '06 #6
willakawill
1,646 Top Contributor
BTW it is much better to explicitly initialize your recordset like this:
Expand|Select|Wrap|Line Numbers
  1. Dim red1 As ADODB.Recordset
  2. Set red1 = New ADODB.Recordset
If you do it this way:
Expand|Select|Wrap|Line Numbers
  1. Dim red1 As New ADODB.Recordset
each time you use red1 it will be checked to see if has been initialized which is inefficient
Dec 24 '06 #7
jamesnkk
134 New Member
BTW it is much better to explicitly initialize your recordset like this:
Expand|Select|Wrap|Line Numbers
  1. Dim red1 As ADODB.Recordset
  2. Set red1 = New ADODB.Recordset
If you do it this way:
Expand|Select|Wrap|Line Numbers
  1. Dim red1 As New ADODB.Recordset
each time you use red1 it will be checked to see if has been initialized which is inefficient
Wow !, Thank so much for your coding, I got it work now !, and Thank so Much for the explanation. Also Thank Sashi, Thank God, I came to the right forum.
Dec 24 '06 #8
sashi
1,754 Recognized Expert Top Contributor
Wow !, Thank so much for your coding, I got it work now !, and Thank so Much for the explanation. Also Thank Sashi, Thank God, I came to the right forum.
Hi there,

Good luck & Take care.
Dec 26 '06 #9

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

Similar topics

8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
11
by: Ken Varn | last post by:
I want to be able to determine my current line, file, and function in my C# application. I know that C++ has the __LINE__, __FUNCTION__, and __FILE___ macros for getting this, but I cannot find a...
2
by: barret bonden | last post by:
(closest newsgroup I could find) Error Type: ADODB.Recordset (0x800A0CB3) Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype....
4
by: bfulford | last post by:
I have a macro that needs to have a progress meter displayed since it is long running. I moved the Macro's instructions to a table and pulled those records into a recordset that is looped through....
5
by: Hexman | last post by:
I've come up with an error which the solution eludes me. I get the error: >An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in HRTest.exe > >Additional...
9
by: Johnfli | last post by:
ADODB.Recordset error '800a0cb3' Current Recordset does not support bookmarks. This may be a limitation of the provider or of the selected cursortype. I am moving my webserver from NT4 using SQL...
9
by: AG | last post by:
Using VS2005 Pro. I just deployed a ASP.NET 2.0 website (not web application) with the option to make it updatable. VS deployed all aspx, ascx files, but not all image or html files. It also...
9
by: BlackMustard | last post by:
Hi, I get the following error on the last line: Run-time error '3251': Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype. ...
2
by: =?Utf-8?B?TUNN?= | last post by:
I have an asp.net page that contains an update panel. Within the update panel, controls get added dynamically. During partial page post backs the controls within the panel will change. I have a...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.