.addnew method of a recordset

Posted on 2001-07-10
Last Modified: 2013-11-25
I am trying to add a record to a recordset, and am using the following code,
but I get an error that reads.
Runtime error 3251
Object or provider not capable of performing this operation

The part the error comes from is the '.addNew' method.
RecSet is an adodb recordset, and I have copiedthe code from the msdn library.
The recordset is open in a datarepeater on another form, would that be the cause???

With recSet.AddNew
   !Surname = Me.Surname.Text
   !FirstName = Me.FirstName.Text
   !Company = Me.Company.Text
   !Address = Me.Address.Text
   !Town = Me.Town.Text
   !Pcode = Me.Pcode.Text
   !ABN = Me.ABN.Text
   !UHF = Me.UHF.Text
   !Phone = Me.Phone.Text
End With
Question by:cassharley
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 51

Expert Comment

by:Ryan Chong
ID: 6268688

try this:

With recSet
  .Fields!Surname = Me.Surname.Text
  .Fields!FirstName = Me.FirstName.Text
  .Fields!Company = Me.Company.Text
  .Fields!Address = Me.Address.Text
  .Fields!Town = Me.Town.Text
  .Fields!Pcode = Me.Pcode.Text
  .Fields!ABN = Me.ABN.Text
  .Fields!UHF = Me.UHF.Text
  .Fields!Phone = Me.Phone.Text
End With

Expert Comment

ID: 6268706
Is the recordset Read-only?
LVL 33

Expert Comment

ID: 6268737
Is the access file read-only? If you are using ntfs partition, you also got to make sure that write permission is granted.

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.


Expert Comment

ID: 6268741
is ther anything to do with your reference file. What type of connection that you used?


Expert Comment

by:Valliappan AN
ID: 6268789
I hope you are opening the recordset in readonly mode.

You could try opening the recordset like this, if I understood properly:

Set rs=new recordset "Select * from table1",Conn1,adOpenKeySet, adLockOptimistic


Hope this would help you.

Expert Comment

ID: 6268811
You need to make the lock-type to 2-pessimistic, or 3-optimistic.
If he it at the defaults setting of 1-readonly.
Well obviously you can't write.

check this by opening the data designer object, and looking in the properties-->Advanced.

If your table or something else is readonly, then you will not be able to change the setting.


Author Comment

ID: 6268828
Thanks, firstly the
.fields thing didn't work.

I agree with you all, the problem is because of the read-only settings,
But I checked out the database, (by actually clicking on the .mdb file) and it is not set read-only. The lock-type is readonly, but it will not let me change it.
I am not sure how to check if an individual table within the .mdb is read-only.

Accepted Solution

calebS earned 75 total points
ID: 6268872
Try this,

On the DEConnection, click on the data link (the thing with the cord hanging off it, I am not sure if datlink is the correct term). Right-click, and choose properties.

Now choose the advanced tab, and set you read/write properties from there.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Spell Check in VB6 13 137
MsgBox 4 71
VBA - If Bookmark = "XXBOOKMARKXX" then 15 51
Powerpoint 2013: Change cell reference in excel link 3 122
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question