Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 28th, 2010, 01:20 AM
Registered User
 
Join Date: Sep 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Database or object is read only

Hi,

I keep getting an error message that the database is read only. I have done quite a bit with the folder and the database to allow access. I pretty sure the problem lies within the code.

Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Users\Wutcha\Desktop\WutchaKnow\NamesAnd Numbers.mdb"
rst.Open "SELECT DISTINCT [Company], [Website], [UserName], [Password], [QuestionA], [AnswerA], [QuestionB], [AnswerB], [QuestionC], [AnswerC] FROM Passwords ORDER BY [Company];", _
cnn, adOpenKeyset, adLockPessimistic

rst.AddNew
Do Until rst![Company] = Null
rst.MoveNext
Loop
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing

Any suggestions will be much appreciated. Thanks in advance!
 
Old September 28th, 2010, 08:37 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi...

select distinct, addnew, do until (after an add new)... All this code doesn't make any sense... maybe that why is not working???
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old September 28th, 2010, 01:48 PM
Registered User
 
Join Date: Sep 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I have the code behind a submit button in a word document. I'm wanting to add a new row to the access database with some information in the text boxes that are in the word document. I probably should have said this earlier.
 
Old September 28th, 2010, 03:39 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

That's ok, but you are doing a add new, and instantly try to go to the next record...

there is something more missing here... you are never passing data to the recordset!
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Database or object is read-only ryanb Access ASP 25 January 17th, 2014 06:36 PM
Cannot Update. Database or Object is Read Only randy768 BOOK: Excel 2003 VBA Programmer's Reference 3 May 27th, 2009 09:57 AM
Serializing needs File object on Read, not on Write jcotton BOOK: Beginning Java 2 0 May 7th, 2009 10:36 AM
Cannot update. Database or object is read-only. zedekiah Classic ASP Databases 1 May 2nd, 2008 09:30 AM
Read only Database error larry101 Classic ASP Databases 4 September 11th, 2004 08:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.