Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:12:39+00:00 2026-06-13T06:12:39+00:00

I have a classic ASP page, which includes a server side in the section

  • 0

I have a classic ASP page, which includes a server side in the section

<!--#include file="../includes/DataTransferFunctions.asp"-->

Within this function, I have the following at the top of the library file,

  Dim wsDataToXferArray()

and then, within one of the functions in the library, it does

 redim preserve wsDataToXferArray(3,pSub).

This doesn’t work as I get a type mismatch on the redim statement. However, if I have the Dim statement at the top of the main ASP instead of at the top of the include library it works.

I need to be able to declare the variable in a global scope so that is it available to more than one function within the library, but have it so that it is defined within the library code so that it is self-contained. I feel as though I’m missing something obvious.

Thanks.

Here are cut-down versions which show the problem. I have included the main ASP and the relevant library which shows the location of the ‘2 Dim’ statements.

Thanks.

<%@ language = vbscript %>
<% Option Explicit %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%

Response.Buffer = true
Response.ContentType = "text/html"
Response.AddHeader "Content-Type", "text/html;charset=ISO-8859-1"
Response.CodePage = 1252
Response.CharSet = "ISO-8859-1"

Dim wsResult,wsDatabase
Dim wsSubX
'
'Dim wsDataToXferArray()

subRoutine()
'
'------------------------------------------------------------------------------------------------
sub subRoutine
'------------------------------------------------------------------------------------------------

    wsSubX  = 0
'
    if wsResult = "" then wsResult  = fncEnableSetAndCreateDataTransfer(wsDatabase,"LK-PART","abc","A",wsSubX)              :   wsSubX  = wsSubX + 1

End Sub

%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
<title></title>
<%
SubIncludeOtherStyleSheets
SubIncludeJs
%>

<!--Include file containing functions to convert dates and to get sales order status description -->
<!--#include file="../includes/date_convert.asp"-->
<!--#include file="../includes/KHDataTransferFunctions.asp"-->
<!--#include file="../includes/IncludeStyleSheets.asp"-->
<!--#include file="../includes/IncludeJs.asp"-->

</head>

<body>

<form action="KHPartMaintenance.asp" method="post" name="form1" id="form1" >

<table class="tableForm Center Font7pt" width="1000">
    <thead>
    <tr>
        <th colspan="5">Part Maintenance</th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td><input type="submit" class="submit1" name="submit1" id="btnList" value="Get Part" onclick="javascript:return fncFormOnSubmit('Get');" /></td>
    </tr>
    </tbody>
</table>

</body>
</html>

This is the KHDataTransferFunctions.asp library.

<%
Dim wsDataToXferArray()

'------------------------------------------------------------------------------------------------
function fncEnableSetAndCreateDataTransfer(pDatabase,pName,pValue,pDataType,pSub)
'------------------------------------------------------------------------------------------------
'
Dim wsPrefix    :   wsPrefix = left(pName,2)
'
    fncEnableSetAndCreateDataTransfer   = ""

    call subAddFieldToDataTransferArray(wsPrefix,pName,pValue,pDataType,pSub)

end function

'------------------------------------------------------------------------------------------------
sub subAddFieldToDataTransferArray(pPrefix,pName,pValue,pDataType,pSub)
'------------------------------------------------------------------------------------------------
'
' Build the array of the fields for each 'transaction'.
'
    redim preserve wsDataToXferArray(3,pSub)

    wsDataToXferArray(0,pSub)   = pPrefix
    wsDataToXferArray(1,pSub)   = pName
    wsDataToXferArray(2,pSub)   = pValue
    wsDataToXferArray(3,pSub)   = pDataType
'   
End Sub

%>

I’ve resolved the problem. It was caused by the position of the include files within the ASP page.

Here’s the revised code (well, part of it ….).

<%@ language = vbscript %>
<% Option Explicit %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%

Response.Buffer = true
Response.ContentType = "text/html"
Response.AddHeader "Content-Type", "text/html;charset=ISO-8859-1"
Response.CodePage = 1252
Response.CharSet = "ISO-8859-1"
%>
<!--Include file containing functions to convert dates and to get sales order status description -->
<!--#include file="../includes/date_convert.asp"-->
<!--#include file="../includes/KHDataTransferFunctions.asp"-->
<!--#include file="../includes/IncludeStyleSheets.asp"-->
<!--#include file="../includes/IncludeJs.asp"-->
    <%
Dim wsResult,wsDatabase
Dim wsSubX
'
'Dim wsDataToXferArray()

subRoutine()
'
'------------------------------------------------------------------------------------------------
sub subRoutine
'------------------------------------------------------------------------------------------------

    wsSubX  = 0
'
    if wsResult = "" then wsResult  = fncEnableSetAndCreateDataTransfer(wsDatabase,"LK-PART","abc","A",wsSubX)              :   wsSubX  = wsSubX + 1

End Sub

%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
<title></title>
<%
SubIncludeOtherStyleSheets
SubIncludeJs
%>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:12:41+00:00Added an answer on June 13, 2026 at 6:12 am

    Problem was caused by the location of the server side include files. These need to be before the main ASP code gets executed, so that any global variables are declared early enough.

    See the block with the modified code in the original post for the solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a select box on a classic ASP page which looks like this:
I have a 3rd party server which has a classic ASP page which takes
I have a classic asp page which has, encapsulated within it in an iframe,
I have a classic ASP application which inserts some values into a word file
I have a classic ASP page which is loading an ASP.net page through an
I am writing a small application in Classic ASP. I have a page which
I have a classic asp page which generates a PDF serves it to the
I have a classic asp page from which I open a popup page in
We have a classic VBScript default.asp page in the root of our site. (This
NET and VB.net code behind. I have a classic ASP page that connects to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.