This Doesn't Work?

Results 1 to 3 of 3

Thread: This Doesn't Work?

  1. #1
    Join Date
    Dec 1969

    Default This Doesn't Work?

    const intMaxNumberOfRecords = 100<BR><BR>...<BR>...<BR><BR>Dim arrRecords(intMaxNumberOfRecords)<BR><BR>error says that you need a const integer to init an array... duh<BR><BR>there&#039;s gotta be a way to do this without Redim.. how is it done?<BR><BR><BR>Jason Connell<BR>

  2. #2
    John D Guest

    Default RE: This Doesn't Work?

    Jason,<BR>The reason this happens is that memory for all the variables (including) arrays is allocated before the code is actually looked at. Instead here&#039;s what you should do:const intMaxNumberOfRecords = 100<BR>...<BR>...<BR>Dim arrRecords<BR>arrRecords = Array(intMaxNumberOfRecords)<BR><BR>The reason this works is that arrRecords is now a varible that is a "variant" instead of an array. then it is set to an array.<BR><BR>Hope that helps,<BR>John

  3. #3
    Join Date
    Dec 1969

    Default That sucks

    When i did that, it gave me some error which seemed to tell me that any arguments inside the (...) of arrSomeArray = Array(...) basically makes that array equal to<BR>arrSomeArray(0) = ...<BR>because it told me that Subscript 1 was out of range. i used redim instead, thanks anyway, i really appreciate it.<BR><BR>Jason

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts