Solved

variant into string

Posted on 2006-06-16
5
609 Views
Last Modified: 2010-04-30
Hello Guys,
                  I got a string value "A" in a variant array that shows Variant/String type for the string's values. However,
the functions recieving the array's values compalin of type mismatch. How do convert variant into string???

Thanks,
Serge
0
Comment
Question by:Autofreak
5 Comments
 
LVL 95

Accepted Solution

by:
Lee W, MVP earned 65 total points
ID: 16924405
CStr(Variant)
0
 
LVL 15

Assisted Solution

by:JackOfPH
JackOfPH earned 20 total points
ID: 16925672
dim x
dim y as string

y = cstr(x)
0
 
LVL 20

Assisted Solution

by:alainbryden
alainbryden earned 20 total points
ID: 16925864
you should probably check just to be sure:

Dim x as integer
Dim StrResult As String
Dim VarArray() As Variant
...
...
If isAlphaNumeric( VarArray(x) ) then
   StrResult = CStr( VarArray(x) )
Else
   StrResult = vbNullString
End If
0
 
LVL 8

Assisted Solution

by:kaliyugkaarjun
kaliyugkaarjun earned 20 total points
ID: 16933332
I think u need to loop through the variant and for each item in a variant (i.e. variant_array_name(0), variant_array_name(1),.....) use function cstr() to convert it to string...

0
 

Author Comment

by:Autofreak
ID: 16964476
Thank you Guys, all answeres halped me.
Serge
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now