declare a varible so I can use it anywhere??
I have a question. I have a program that uses a common dialogue box to import a .dat file. the .dat file has lines of info like this for example:
"905","Car, Sedan",22897
"503","Yogurt, Plain",1.28
"601","Cola, 2 ltr",1.29
"602","Cola, diet 2 ltr",1.29
"603","Cola, 6 pack",1.85
I open the file like this:
ProdFileName = CDL1.FileName '** Remember product file name
Open ProdFileName For Input As #6 '** Open the product file
I = 1 '** Start with first product
Do Until EOF(6) '** Until the end of the file
Input #6, UPC(I), ProdDesc(I), ProdPrice(I) '** Read I-th product
I = I + 1 '** Anticipate next product
Loop
NumProducts = I - 1 '** Remember number of products read
Close #6
having CDL1 the name of the common dialogue box. Now when I want to call UPC(I), ProdDesc(I), or ProdPrice(I), I will have to call them in two different form. This means that I have to declare the varibles Globally. How exactly do I do this?? Do I have to use a modual? I tried this:
Global UPC(MaxProducts) As String '** Array for UPC codes
Global ProdDesc(MaxProducts) As String '** Product descriptions
Global ProdPrice(MaxProducts) As Currency '** Product prices
Global I As Integer '** Variable used to index these arrays
Global NumProducts As Integer '** Variable providing number of products read.
I put that into a modual, and I recieved an error when I was trying to open ProdFileName. I defined ProdFileName as Global in the modual as well.
'------Varibles to define the arrays------------
Global ProdFileName As String '** Variable providing name of product file.
What am I doing wrong?? Please help me. Thanks :)
Brian