Microsoft KB Archive/172547

= ACC97: "Can't Open the Table" in Data Source of ASP File Error =

Article ID: 172547

Article Last Modified on 1/20/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q172547



Moderate: Requires basic macro, coding, and interoperability skills.



SYMPTOMS
When you try to open a Microsoft Access table in Design view, you may receive the following message:

  You can't open the table for modification.

A query or form bound to the table is open, you may not have permission to open this table in Design view, or another user has the table open. Do you want to open this table as read-only?

If you have opened a query or form bound to this table, close it, and then try again to open the table in Design view.

You may also receive errors if you try to move or copy a database in Windows Explorer; for example you may receive the message:

Cannot move : There has been a sharing violation.

The source or destination file may be in use.

  -or-

Cannot rename : Access is denied.

Make sure the disk is not full or write-protected and that the file is not currently in use.



CAUSE
The database is an ODBC data source that is used by an ASP file. For example, this behavior would occur if the table itself, or a query or form based on that table, had been exported to ASP format. Although the ASP file, itself, may not currently be open in a user's browser, the Session object for a particular user session persists for the period of time specified by its Timeout property. The ASP file contains code that creates a connection object and stores that connection in the session variable. Therefore, the connection to the Microsoft Access database that serves as the ODBC data source persists until the session times out. The default value of the Timeout property is 20 minutes.



RESOLUTION
Use one of the following methods to resolve this issue.

Method 1
Instead of editing the database that is the ODBC data source, edit a copy of that database. When all sessions have expired, export the redesigned table to the ODBC data source, or copy the database itself to the file that serves as the data source. This is the recommended method to resolve this issue.

Method 2
Export the database object to ASP format again, and use the "Publish to the Web" Wizard to specify to Timeout property. To do so, follow these steps:


 * 1) On the File menu, click Save As HTML.
 * 2) In the first screen of the "Publish to the Web" Wizard, click Next.
 * 3) When asked what you want to publish, select the database object(s) that you want to export to ASP format, and then click Next.
 * 4) Choose a template if you want, and then click Next.
 * 5) Select Dynamic ASP (Microsoft Active Server Pages), and then click Next.
 * 6) Supply the necessary Data Source Information and the URL of the server location to which you are saving the file. In the Session Timeout box, type the number of minutes for which the Session object should persist, and then click Next.
 * 7) Specify the folder to which you want to publish, and then click Next.
 * 8) Click to select the check box if you want to create a home page and click Next; then, click to select the check box if you want to save a publication profile.
 * 9) Click Finish.

Method 3
NOTE: This section contains information about editing ASP files, and assumes that you are familiar with editing ASP files. Microsoft Access Product Support professionals do not support customization of any HTML, HTX, IDC, or ASP files.

Edit your ASP file and specify the value of Session.Timeout. To do so, follow these steps:

 Open the ASP file in a text editor, such as Notepad.  Locate the following text after the TITLE tags near the beginning of the file:

       <%     If IsObject(Session("_conn")) Then   Edit the text so that it reads as follows

<pre class="fixed_text">     </HEAD> <BODY> <%     Session.timeout = n      If IsObject(Session("<ODBC Data Source Name>_conn")) Then

where n is the number of minutes for which you want the session to last before it times out. </li> Save and close the file.</li></ol>

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

Steps to Reproduce Behavior
The following example assumes that you have created an ODBC data source based on the sample database Northwind.mdb.

<ol> Start Microsoft Access and open the sample database Northwind.mdb.</li> On the File menu, click Save As HTML.</li> In the first screen of the "Publish to the Web" Wizard, click Next.</li> When asked what you want to publish, select the Products form, and then click Next.</li> In the screen that asks you to select a template, click Next.</li> Select Dynamic ASP (Microsoft Active Server Pages), and then click Next.</li> Supply the necessary Data Source Information and the URL of the server location to which you are saving the file; leave the Session Timeout box blank, and click Next.</li> Specify the folder to which you want to publish, and then click Next.</li> Click Finish, and then close the database.</li> Open a browser on a client computer and type the URL for Products_1.asp in the Address box. For example:

http://%3Cservername%3E/scripts/Products_1.asp</li> Close the browser.</li> On the server, open the sample database Northwind.mdb in Microsoft Access.</li> Try to open the Products table in Design view. Note that you receive the following error:

You can't open the table 'Products' for modification.

</li></ol>

<div class="references_section">