Microsoft KB Archive/164753

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

Article ID: 164753

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q164753



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



SUMMARY
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 Product Support professionals 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:

 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. 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. 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. Use Notepad or another text editor to open the file that contains the characters "alx."  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   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  Save the changes, and close the file.</li> 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.</li></ol>

<div class="references_section">