I think it was a Microsoft "feature". I can remember back a few years ago
when they trained you to do it this way, and then someone pointed out the
problem. It can be hard to trace because usually a variant will morph to
whatever you are assigning to it - but it's a memory hog. 

-----Original Message-----
From: Lew Hundley [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 15, 2003 1:29 PM
To: [EMAIL PROTECTED]

Thanks David!

I can see how the Dim can be interpreted in that way. So perhaps my
memory is faulty from my VB6 training.
Maybe I was remembering back to my C days...

TKs

Lew Hundley
Information Specialist - Programmer
Silverton Hospital
Silverton Oregon
503.873.1657
[EMAIL PROTECTED]



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Higginson, David
A
Sent: Tuesday, July 15, 2003 11:05 AM
To: [EMAIL PROTECTED]
Subject: RE: [Talk] OT (off topic): Any VBA experts, I have a question.


Dim sReturnFile, sVisitNo As String

Actually dim's sReturnFile as a variant and sVisit as a String
Breaking them up forced strong typing

This is fixed in dot net.

-David


-----Original Message-----
From: Lew Hundley [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 15, 2003 12:58 PM
To: BostonWorkStation Talk

 
I just spent the better part of an hour tracking down an issue with my
script. It turned out to be a VBA problem, I think.
 
Since my last testing, I had added sVisitNo to the following Dim:
 
Dim sReturnFile, sVisitNo As String
 
When I ran my code to test, I got this error:
 
 

 
 
 
After pulling my hair (as in only one left) out trying to debug this, I
finally did a comparison of the code in issue, found the aforementioned
Dim,
and decided to break it apart, like this:
 
Dim sReturnFile As String
Dim sVisitNo As String
 
 
Of course, you know the outcome; it words fine now, no compile error.
 
So my question is, why, when multiple Dims are broken down into single
Dims,
does the compiler change its mind and recognize this as a ByVal Dim, and
not
the apparent ByRef of the multiple Dim?
 
I am up and running now, so this is not a critical question. I am just
curious. My VB6 training, as I remember, taught me that I could do
multiple
Dims using a common 'As' command. Or am I hallucinating...
 
TKs
 
Lew Hundley
Information Specialist - Programmer
Silverton Hospital
Silverton Oregon
503.873.1657
[EMAIL PROTECTED]
 
 
 


The information contained in this message is confidential and is
intended for the addressee only.  If you have received this message in
error or there are any problems, please notify the sender immediately.
The unauthorized use, disclosure, copying or alteration of this message
is strictly forbidden. 




The information contained in this message is confidential and is intended for the 
addressee only.  If you have received this message in error or there are any problems, 
please notify the sender immediately.  The unauthorized use, disclosure, copying or 
alteration of this message is strictly forbidden. 



Reply via email to