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



The information in this article applies to:

  • Microsoft Access 97

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:

  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. 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.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbhowto kbinterop kbProgramming KB164753