ACC97: How to Get a Calendar Control to Work on an ASP Page

Last reviewed: August 29, 1997
Article ID: Q164753
The information in this article applies to:
  • Microsoft Access 97

SUMMARY

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

When you export a form that contains a Calendar Control as an Active Server Page, any code that you create for the control will not be exported with the form. When you open the form on your Web browser, the Calendar Control will be set to the current date. To be able to set the value for the Calendar Control on your Active Server Page, you will need to modify the VBScript for that form.

This article demonstrates how you can modify the VBScript code to include the syntax you need for setting the value of the Calendar Control.

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 Technical Support engineers do not support customization of any HTML, HTX, IDC, or ASP files.

The following example demonstrates how to change the VBScript code in an ASP file so that it contains the code necessary for changing the value for a Calendar Control. To modify the VBScript for a particular form, follow these steps:

  1. Find the folder that contains the ASP files for the Active Server Page that you want to modify. This should be the same folder that you specified in the Server URL box, in the Microsoft Active Server Pages Output Options dialog box, when you output the file as an Active Server Page.

  2. 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). For example, if you exported a form with the name Employees, the two file names that should appear in the folder are Employees and Employeesalx.

  3. Use Notepad or another text editor to open the file that contains the characters "alx."

  4. Scroll through the file, until you come to the OnLoad Function for the form. For the EmployeesAlx form, this function would be

          Sub EmployeesAlx_OnLoad()
    
    

  5. Add the following line to the procedure

          CalendarControlName.Value = NewValueForControl.Value
    

    where CalendarControlName is the name of the Calendar Control and NewValueForControl is the value you want to apply to the control. For example, if you want to set a Calendar Control called ActiveXCTL1 to the value contain in a control called Birthdate, you would type the following in the Sub procedure:

          ActiveXCtl1.value = Birthdate.value
    

  6. Save the changes, and close the file.

  7. Start your Web browser and type the URL in the address box for your Active Server Page.

    The form should open and the Calendar Control should be set to the date you specified in your form Load event procedure.

    NOTE: Any changes you make to the ASP file may be lost once you export the form again.

REFERENCES

For more information about ASP files, search the Help Index for "ASP files," and view the available topics, or ask the Microsoft Access 97 Office Assistant.

Keywords          : IntpCstm kbinterop IntAsp
Version           : 97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.