Microsoft KB Archive/173003
Article ID: 173003
Article Last Modified on 1/20/2007
- Microsoft Access 97 Standard Edition
This article was previously published under Q173003
Moderate: Requires basic macro, coding, and interoperability skills.
When using Microsoft Active Server Pages (ASP) to add data to a Microsoft Access database, data is truncated in some fields.
The Method attribute of the Form tag is set to Get in the ASP form, and the combined length of the data in fields you are editing plus the length of their field names exceeds the number of characters allowed on the address line of your Internet browser.
When you set the Method attribute of the Form tag to Get, the ASP form passes parameters containing the data via the Internet browser's address line. This limits the number of characters that an ASP form can submit to the database to the maximum number of characters allowed on your Internet browser's address line. Because ASP forms pass other parameters on the address line, such as the name of the field the data is being written to, the actual data written to the database will be less than the amount allowed on the browser's address line.
Steps to Reproduce Behavior
- Create a System DSN on your Web server that points to the Northwind sample database. For more information about creating a System DSN, please see the following article in the Microsoft Knowledge Base:
159682 ACC97: "Data Source Name Not Found" Err Msg Opening Web Page
- Start Microsoft Access 97 and open the sample database Northwind.mdb.
Create the following table:
Table: tblASPTest Field Name: MemoText Data Type: Memo Indexed: No
Save the table as tblASPTest. When asked if you want to create a Primary Key, click No.
Create a module and type the following line in the Declarations section:
Type the following procedure in the module you just created:
Sub FillMemo() Dim db As Database Dim rs As Recordset Dim intCount1 As Integer, intCount2 As Integer Set db = CurrentDb Set rs = db.OpenRecordset("tblASPTest") With rs .AddNew ![MemoText] = "A" For intCount1 = 0 To 25 For intCount2 = 1 To 100 ![MemoText] = ![MemoText] & Chr(intCount1 + 65) Next intCount2 Next intCount1 .Update End With db.Close End Sub This procedure fills the memo field in the first record with 2601 characters.
- Create a new query based on tblASPTest. In the first field in the query grid, type the following expression:
- Save the query as qryASPTest.
- Run the query and notice that it returns 2601.
- Close the query.
- In the database window, click the Forms tab, and then click New.
- In the New Form dialog box, click AutoForm: Columnar, and type or select tblASPTest.
- Close the form, and save it as frmASPTest.
- Click frmASPTest in the Database window, and then click Save As/Export on the File menu.
- In the Save As dialog box, click "To an External File or Database," and then click OK.
- In the "Save 'frmASPTest' In" dialog box, click "Microsoft Active Server Pages (*.asp)" in the Save As Type list, and type frmASPTest.asp in the File Name box. Select a folder to store the files, and then click Export.
- In the "Microsoft Active Server Pages Output Options" dialog box, type the name of a System DSN on your Web server that points to the Northwind sample database in the Data Source Name box.
- In the Server URL box, type the Uniform Resource Locator (URL) that points to the Web Server location where your ASP files will be stored, and then click OK.
For example, if you store the ASP files in the \ASPsamp folder on the \\PubTest server, type http://pubtest/aspsamp/ as your Server URL. Microsoft Access creates the files frmASPTest.asp and frmASPTestalx.asp.
- Start Microsoft Internet Explorer, or another Web browser program.
- Type the URL in the address box of your Web browser to view frmASPTest.asp.
For example, if you saved the .asp file in a folder called Test in the wwwroot folder of your Web Server, type:
Note that the URL depends upon where your files are located on the Web server.
- Add one character to the memo field displayed in the browser, and then click Commit.
After you have committed the record, note that the address box contains not only the actual data, but also additional information, such as the name of the field.
- Click Refresh.
- Return to Microsoft Access and open qryASPTest in Northwind.mdb.
Note that the query no longer returns 2601. The number you see is the maximum number of characters that can be returned to the database by the browser minus any non-data characters, such as field names, which were needed to return the data to the database.
For more information about truncation of parameters in Internet forms, please see the following article in the Microsoft Knowledge Base:
153976 Text Sent Via Forms Command Is Truncated
For more information about Microsoft Active Server Pages, search the Help Index for "ASP files," or ask the Microsoft Access 97 Office Assistant.
Additional query words: prb memo
Keywords: kbprb KB173003