views:

532

answers:

3

I have a database that the client needs to update. They like to you access. Some tables randomly become read-only for them. Any ideas why?

They are using Access 2007 and MS SQL 2005.

SQL Table:

CREATE TABLE [dbo].[Users](
    [SyncGroup] [varchar](20) NULL,
    [UserID] [varchar](20) NOT NULL,
    [Password] [varchar](20)  NOT NULL,
    [Restriction] [text] NULL DEFAULT (' '),
    [SiteCode] [varchar](20) NULL,
    [Group] [varchar](20)  NULL,
    [EmpId] [varchar](20)  NULL,
    [TimeZoneOffset] [int] NULL,
    [UseDaylightSavings] [bit] NULL,
    PRIMARY KEY ([UserID]) )
A: 

are users accessing the database while you're trying to do stuff iwth sql? if so, then you will get an error message stating that the database is in use and is read only. no one can be in the database when you are doing things with it though sql.

DForck42
I think we need to quantify "doing stuff with SQL." By "doing stuff with SQL" do you mean making schema changes? Or manipulating data? Besides me there is a automated system that is constantly (every 3 min or so) reading from the table. I haven't noticed an reproducible issue with manipulating data. Access just decides it's just not going to allow changes.
NitroxDM
+3  A: 

Access really likes having a TimeStamp aka RowVersion field on every table. I don't know if this will fix your problem though.

"On servers that support them (such as Microsoft SQL Server), timestamp fields make updating records more efficient. Timestamp fields are maintained by the server and are updated every time the record is updated. If you have a timestamp field, Microsoft Access needs to check only the unique index and the timestamp field to see whether the record has changed since it was last retrieved from the server. Otherwise, Microsoft Access must check all the fields in the record. If you add a timestamp field to an attached table, re-attach the table in order to inform Microsoft Access of the new field."

http://technet.microsoft.com/en-us/library/cc917601.aspx

Tony Toews
Adding a time TimeStamp appears to be working. I need to to some more testing... but so far it looks good.
NitroxDM
That did the trick! Thanks!
NitroxDM
I have a hunch it was reattaching rather than the timestamp. Had you tried reattaching to fix it?
le dorfier
Glad to hear it. Now why this would make a difference I don't quite know. I'm not an Access <> SQL Server expert. Yet. I will be doing a large upsizing in a month or two.
Tony Toews
@le dorfier -- That was the first thing I tried 2 weeks ago. Some times it would work. If it did work it wasn't long until it became read-only again. I was just on the phone with the client, we both saw a message we had never seen before. Now instead of just going read-only, there is a popup "The data has been changed." Upon clicking OK the data reloads and you can manipulate it and save with out error.
NitroxDM
It is true that alterations to a SQL Server table can make an ODBC link to it from an Access front end read-only (same with links to views). I put a timestamp in all my SQL Server tables as a matter of course. Can anyone see any harm in that?
David-W-Fenton
I'm not sure how it fixes the problem, which is that you're changing a record state that no longer exists.
le dorfier
A: 

Sounds like a permissions problem. Are you keeping careful track of who is altering the schema? You may have users who aren't permitted to use changes made by certain other users.

le dorfier
I don't think that is the issue. I'm the only one that has or will (in the foreseeable future anyway) make schema changes. Beyond that I have the same issue when I use my credentials.
NitroxDM
Did you faithfully reattach Access to SQL Server each time you changed the schema?
le dorfier