Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DIM

Status
Not open for further replies.

AdamWhitehouse

Programmer
Aug 7, 2000
34
GB
Yes its me thats Dim, I have copied a folder of a project I am creating, from one PC to another, when I try to run the project on the other pc it gives me an error for all the variables I have not Dim'med and yet the same project runs happily on the original pc, why?? I know the answer is probably easy but I can not find a cure, I thought it was something in my VB6 setup, so I created a new project and tried the same scenario and that works ok, very confused!

What it won't let me do is :-

For a = 1 to 50
next

It doesn't know what 'a ' is

Can some one please give me a lesson!!

Thanks
 
TYPE option explicit, probably not on default on the orginal pc

tools, options
require variable declaration
 
I have already set option explicit in the used modules, and as far as I can see all the modules I have used are in the folder that I have copied! I did think of going through the routine and assigning problem variables but it is as large program and has in excess of 1000, The code used to work on both systems, but I am developing it on my laptop and transferring it to an industrial Pc on site, and since my last upgrade the problem has developed.

I am still open to any suggestions?

Adam
 
I'm with Trainingjason. It does sound like OPTION EXPLICIT has been activated in one computer but not in the other. --MiggyD

Never be afraid to try something new. Remember that amateurs built the Ark. Professionals built the Titanic.
 
How can I set Option Explicit on one computer and not another? It is the same code I have copied across, surely the option explict in my Module.bas will remain the same?

Adam
 
Option Explicit is used to force you to declare your variables (either Globally as in a MODULE for use throughout your entire prg.. or Locally as in a Form for use JUST WITHIN that form--meaning that no other form has any right to use that "localized" varible)

So if one machine has OPTION EXPLICIT turned ON then the prg will produce the warning/error you're describing. While the other (turned OFF) won't care if there's memory reserved for that variable or not.

Again, check of OPTION EXPLICIT..in VB4 it's TOOLS>OPTIONS (first tab)...checkbox for "Require Variable Declaration".

I can't recall where in VB6 it may be, but I know it's there. --MiggyD

Never be afraid to try something new. Remember that amateurs built the Ark. Professionals built the Titanic.
 
Ok Ive checked the programs out, and all modules are identical, all folders are intact and are in the correct place and the "Require Variable Declartions" are un checked on both Pc's and I get no errors when the program is loading up, only when I try to compile / run it, on one of the pc's?

Help getting desperate?
 
Have you looked at the Project References to see if one is missing. Sometimes you can get an error message which makes no sense because of this.

Select Project -> References and see if any item which is checked has the word MISSING associated with it
Good Luck
------------
Select * from Users where Clue > 0
0 rows returned
 
Do you have any thrid party controls in the app the require a license on the machine you copied it to??

chadt@techtnologies.com
 
Thanks all for your help,,, sorted the problem..but I still don't know why it existed , I deleted the project folder and repasted it in from my laptop, and it works fine, this procedure is exactly what caused the problems in the first place..

Adam
 
Good job, CajunCenturion. --MiggyD

Never be afraid to try something new. Remember that amateurs built the Ark. Professionals built the Titanic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top