Microsoft Knowledge Base Email Alertz

KBAlertz.com: (165629) - When you export a form from Microsoft Access 97 as an Active Server Page, and that form has custom buttons that move from one record to the next, the buttons will not work on your Active Server Page form. This happens because the Visual Basic code...

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **


Bug Tracking Software
For bug tracking software or defect tracking software or issue tracking software, visit Axosoft.


Community Site



We Send hundreds of thousands of emails using ASP.NET Email



Expert Web Design & Graphic Design
Design44.com

ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 165629 - Last Review: January 19, 2007 - Revision: 3.3

ACC97: How to Create Custom Navigation Buttons on an ASP Page

This article was previously published under Q165629
Moderate: Requires basic macro, coding, and interoperability skills.

SUMMARY

When you export a form from Microsoft Access 97 as an Active Server Page, and that form has custom buttons that move from one record to the next, the buttons will not work on your Active Server Page form. This happens because the Visual Basic code that performs the actions in Microsoft Access is not exported to your Active Server Page form.

There are two ways to have navigation buttons appear on your Active Server Page form:
  • Use the Microsoft Access built-in navigation buttons and set the Navigation property of the form to Yes.
  • Modify the VBScript for the Active Server Page form that you are exporting so that the code will allow you to move through your form as you click a button.

MORE INFORMATION

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

This article demonstrates a method that creates custom navigation buttons that enable you to move through the form by modifying the VBScript for the Active Server Page file. To modify the VBScript for a particular form, follow these steps:
  1. Create the form that you will be using as an Active Server Page and add the following command buttons to the form:
       Command Button:
          Name: MoveNextRecord
          Caption: MoveNextRecord
    
       Command button:
          Name: MoveFirstRecord
          Caption: MoveFirstRecord
    
       Command button:
          Name: MoveLastRecord
          Caption: MoveLastRecord
    					
  2. Set the Navigation property of the Form to No.
  3. Export the form to Active Server Page format and note the folder to which the file is exported. There should be two files in this folder that are associated with your Active Server Page. One of the files will contain the characters "alx" (without the quotation marks).
  4. Use Notepad or another text editor to open the file that contains the characters "alx." You should see code similar to the following:
          <SCRIPT LANGUAGE=VBScript>
          <!--
          Dim rgszCtrls(6,2)
          Dim cMaxCtrls
          cMaxCtrls = 6
    
          Sub AddCtrlToList(szCtrl, szCtrlSrc)
              Dim i
              for i = 1 to cMaxCtrls
                  if rgszCtrls(i, 1) = szCtrl Then Exit Sub
                  if rgszCtrls(i, 1) = "" Then
                      rgszCtrls(i, 1) = szCtrl
                      rgszCtrls(i, 2) = szCtrlSrc
                      Exit Sub
                   End If
               next
           End Sub
    					
  5. Add the following three Sub procedures to the code just before the line that reads </SCRIPT>.

    NOTE: In the following sample code, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code.
          Sub FirstRecord_MoveFirstRecord_Click()
    
              Window.Location.Href =
                  "/scripts/formname.asp?nav_btn=nav_btn_MoveFirstRecord&" _
              & GetCtrlQueryString()
    
          End Sub
    
          Sub NextRecord_MoveNextRecord_Click()
    
              Window.Location.Href =
                  "/scripts/formname.asp?nav_btn=nav_btn__MoveNextRecord&" _
              & GetCtrlQueryString()
    
          End Sub
    
          Sub LastRecord_MoveLastRecord_Click()
    
              Window.Location.Href =
              "/scripts/formname.asp?nav_btn=nav_btn__MoveLastRecord&" _
              & GetCtrlQueryString()
    
          End Sub
    					
  6. Modify the OBJECT ID's for the above controls in the </SCRIPT> section and replace the names as follows:
           FirstRecord = FirstRecord_MoveFirstRecord.
           NextRecord = NextRecord_MoveNextRecord.
           LastRecord = LastRecord_MoveLastRecord.
    					
  7. Close and save the file.
  8. Open your Web browser and your Active Server Page form. Click one of the custom command buttons. The buttons should now enable you to move through the pages.

REFERENCES

For more information about what can be exported to ASP format, search the Help Index for "ASP files," and then view the topic "Using Supported and unsupported form controls for dynamic ASP format," or ask the Microsoft Access 97 Office Assistant.

APPLIES TO
  • Microsoft Access 97 Standard Edition
Keywords: 
kbhowto kbinterop kbprogramming KB165629
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please