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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

concatenation operation for two variable

Status
Not open for further replies.

senweb

Programmer
Apr 7, 2011
7
Can any one help me solve an issue in VB6:

dim C1,C2 as double
C1=15
C2=17

By executing a query i will get an integer (field name Wrnk) (ex: 1 or 2)
with that i assign as C2=C2-C1

like:
C & Int(SQL!Wrnk) = C & Int(WSQL!Wrnk)-C1

in coding i can able to see SQL!Wrnk=2
but its not concatenate with variable C

i am expecting C2 value here -- but its not coming.

please help me to solve this issue.

regards,
sensa.
 
Firstly:

>dim C1,C2 as double

C1 is not, as you might think, being dimmed as a double here. it is being dimmed as a variant. You have to be explicit:

dim C1 as double, C2 as double

Secondly, you can't really do what you are suggesting in VB6, at least not directly. There are a couple of alternatives; you could rethink it slightly and work with an array:

Dim C(1 to 2) as Double

leading to:

C(Int(SQL!Wrnk)) = C(Int(WSQL!Wrnk))-C(1)







 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top