Solved

.addnew method of a recordset

Posted on 2001-07-10
8
488 Views
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
   .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
   .Update
End With
0
Comment
Question by:cassharley
8 Comments
 
LVL 50

Expert Comment

by:Ryan Chong
ID: 6268688
Hi,

try this:

With recSet
  .AddNew
  .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
  .Update
End With
0
 
LVL 1

Expert Comment

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

Expert Comment

by:hongjun
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.

hongjun
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 6

Expert Comment

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

0
 
LVL 9

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
rs.open "Select * from table1",Conn1,adOpenKeySet, adLockOptimistic

rs.AddNew
:
:
rs.Update

Hope this would help you.
0
 
LVL 1

Expert Comment

by:calebS
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.


0
 

Author Comment

by:cassharley
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.
0
 
LVL 1

Accepted Solution

by:
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.

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

839 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