PC Review


Reply
Thread Tools Rate Thread

cannot update. DB or object is read-only 3027

 
 
Tim
Guest
Posts: n/a
 
      12th May 2010
I use Access2007. The codes are:

str = "select StudID, Email from qryTest;"
Set rst = DB.OpenRecordset(str, dbOpenDynaset, dbSeeChanges)
rst.MoveFirst
Do While Not rst.EOF
Call ManipulateData(rst("StudID")) 'call a sub-procedure
rst.Edit
rst("Email") = True
rst.Update
rst.MoveNext
Loop

rst.Close
Set rst = Nothing
DB.Close
Set DB = Nothing
----
The error pops up at rst.Edit saying "cannot update. Database or object is
read-only 3027". Can you help me to identify the problem? Thank you.


 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      12th May 2010
"Tim" <(E-Mail Removed)> wrote in message
news:713FC55F-CBB0-4313-86A5-(E-Mail Removed)...
>I use Access2007. The codes are:
>
> str = "select StudID, Email from qryTest;"
> Set rst = DB.OpenRecordset(str, dbOpenDynaset, dbSeeChanges)
> rst.MoveFirst
> Do While Not rst.EOF
> Call ManipulateData(rst("StudID")) 'call a sub-procedure
> rst.Edit
> rst("Email") = True
> rst.Update
> rst.MoveNext
> Loop
>
> rst.Close
> Set rst = Nothing
> DB.Close
> Set DB = Nothing
> ----
> The error pops up at rst.Edit saying "cannot update. Database or object is
> read-only 3027". Can you help me to identify the problem? Thank you.



What is the SQL of qryTest?

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 
Reply With Quote
 
Tim
Guest
Posts: n/a
 
      12th May 2010
Hi Dirk: The SQL of qryTest is
SELECT DISTINCT tblA.StuID, tblA.Email
FROM tblA
WHERE (((tblA.Email=0));
---
Where Email is a boolean (yes/no) field.
---

"Dirk Goldgar" wrote:

> "Tim" <(E-Mail Removed)> wrote in message
> news:713FC55F-CBB0-4313-86A5-(E-Mail Removed)...
> >I use Access2007. The codes are:
> >
> > str = "select StudID, Email from qryTest;"
> > Set rst = DB.OpenRecordset(str, dbOpenDynaset, dbSeeChanges)
> > rst.MoveFirst
> > Do While Not rst.EOF
> > Call ManipulateData(rst("StudID")) 'call a sub-procedure
> > rst.Edit
> > rst("Email") = True
> > rst.Update
> > rst.MoveNext
> > Loop
> >
> > rst.Close
> > Set rst = Nothing
> > DB.Close
> > Set DB = Nothing
> > ----
> > The error pops up at rst.Edit saying "cannot update. Database or object is
> > read-only 3027". Can you help me to identify the problem? Thank you.

>
>
> What is the SQL of qryTest?
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      12th May 2010
"Tim" <(E-Mail Removed)> wrote in message
news:4BD6592A-D23C-43C8-9623-(E-Mail Removed)...
> Hi Dirk: The SQL of qryTest is
> SELECT DISTINCT tblA.StuID, tblA.Email
> FROM tblA
> WHERE (((tblA.Email=0));
> ---
> Where Email is a boolean (yes/no) field.



There's your problem then. DISTINCT queries aren't updatable, because one
output record can potentially represent multiple input records. If you want
your query to be updatable, you have to remove the DISTINCT keyword, and
live with the possibility that it will return more than one record with the
same combination of StuID and Email. Of course, if StuID is a unique field
in tblA, that's not going to happen -- in that case, there would have been
no need for the DISTINCT keyword (= "Unique Values" property of the query)
in the first place.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 
Reply With Quote
 
Tim
Guest
Posts: n/a
 
      13th May 2010
Got it! Thank you very much for your excellent help! I appreciate it!

"Dirk Goldgar" wrote:

> "Tim" <(E-Mail Removed)> wrote in message
> news:4BD6592A-D23C-43C8-9623-(E-Mail Removed)...
> > Hi Dirk: The SQL of qryTest is
> > SELECT DISTINCT tblA.StuID, tblA.Email
> > FROM tblA
> > WHERE (((tblA.Email=0));
> > ---
> > Where Email is a boolean (yes/no) field.

>
>
> There's your problem then. DISTINCT queries aren't updatable, because one
> output record can potentially represent multiple input records. If you want
> your query to be updatable, you have to remove the DISTINCT keyword, and
> live with the possibility that it will return more than one record with the
> same combination of StuID and Email. Of course, if StuID is a unique field
> in tblA, that's not going to happen -- in that case, there would have been
> no need for the DISTINCT keyword (= "Unique Values" property of the query)
> in the first place.
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
3027 cannot update. Database or object read-only =?Utf-8?B?TWFydGluIEQuIEpvbmVz?= Microsoft Access 4 21st Nov 2006 06:04 PM
Error 3027: cannot update: database or object is read only PaulB Microsoft Access 4 7th Nov 2005 10:14 PM
Error Number: 3027 -- Can't Update. Database or object is read-onl =?Utf-8?B?QnJ1Y2UgRmluc2V0aA==?= Microsoft Access External Data 1 24th Mar 2005 05:27 PM
Cannot Update. Dbs or object is read-only (error 3027) Donal O Leary Microsoft Access External Data 0 9th Oct 2003 09:21 AM
Can't update. Database or object is read-only. (Error 3027) Steve Parry Microsoft Access Security 0 5th Aug 2003 01:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:53 PM.