Solved

variant into string

Posted on 2006-06-16
5
610 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

776 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