David Kasabji
David Kasabji

Reputation: 1069

Assign mltiple values to one variable in VBA for Access

So I am trying to write a code, where I would assign several values to be combined in one variable. The values cannot be manually entered! They are being assigned depending on the Form entry that I have!

value1 = 20
value2 = "Hey"
value3 = 00

Now I want to store all of them combines into one variable:

result = value1 + value2 + value3

This doesnt work as I wrote above.

I want this to be the result:

result = 20Hey00

Can someone please help me out?

Thanks

Upvotes: 1

Views: 52

Answers (1)

user2140173
user2140173

Reputation:

Have you tried using & instead of +? AFAIK, the + only works if all the variables are of String type but in your case it seems you've got some mixed types Long/Int.

Additionally, value3 = 00 seems a bit dodgy because if it was a numerical it would have been evaluated to a single 0 and if it was supposed to be a String it should be wrapped up with quotes value3 = "00"

Upvotes: 1

Related Questions