Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Why my records are read only?

Geek News

Why my records are read only?
Al 12/15/2008 3:56:09 PM
I have an access front end with sql server 2005 back end. when I run the
following code:

Set db = CurrentDb()
Set rst = db.OpenRecordset("tblUserLog",
dbOpenDynaset, dbSeeChanges, dbOptimistic)

With rst
.AddNew
![UserID] = Me![SelectUser]
.Update
End With

The code break on .AddNew and gives me the error message "Cannot update.
Database or Object is read-only"

even though the account I use has the read/write permession and has the
sysadmin role.
any idea?
thanks
Re: Why my records are read only?
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_gmail.com> 12/15/2008 4:19:28 PM
Does tblUserLog have a primary key defined on it? Unless there's a unique
index on the table, it's going to be read-only when connecting using ODBC.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Al" <Al[ at ]discussions.microsoft.com> wrote in message
news:5D25F571-716A-4897-9D62-12538DD2B217[ at ]microsoft.com...
[Quoted Text]
>I have an access front end with sql server 2005 back end. when I run the
> following code:
>
> Set db = CurrentDb()
> Set rst =
> db.OpenRecordset("tblUserLog",
> dbOpenDynaset, dbSeeChanges, dbOptimistic)
>
> With rst
> .AddNew
> ![UserID] =
> Me![SelectUser]
> .Update
> End With
>
> The code break on .AddNew and gives me the error message "Cannot update.
> Database or Object is read-only"
>
> even though the account I use has the read/write permession and has the
> sysadmin role.
> any idea?
> thanks


Re: Why my records are read only?
Al 12/15/2008 4:55:01 PM
Yes you are right. that fixed it.thnx

"Douglas J. Steele" wrote:

[Quoted Text]
> Does tblUserLog have a primary key defined on it? Unless there's a unique
> index on the table, it's going to be read-only when connecting using ODBC.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Al" <Al[ at ]discussions.microsoft.com> wrote in message
> news:5D25F571-716A-4897-9D62-12538DD2B217[ at ]microsoft.com...
> >I have an access front end with sql server 2005 back end. when I run the
> > following code:
> >
> > Set db = CurrentDb()
> > Set rst =
> > db.OpenRecordset("tblUserLog",
> > dbOpenDynaset, dbSeeChanges, dbOptimistic)
> >
> > With rst
> > .AddNew
> > ![UserID] =
> > Me![SelectUser]
> > .Update
> > End With
> >
> > The code break on .AddNew and gives me the error message "Cannot update.
> > Database or Object is read-only"
> >
> > even though the account I use has the read/write permession and has the
> > sysadmin role.
> > any idea?
> > thanks
>
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net