troubleshooting Question

how can I create a Variable on the fly

Avatar of mdlp
mdlpFlag for United States of America asked on
Microsoft AccessVisual Basic Classic
5 Comments2 Solutions330 ViewsLast Modified:
This is much like my last question, I am sorry, for asking questions that I should be able to find the answers to, but I do not quite know the correct descriptors to get them.  

So I have 20 variables;
dim  sP1FieldName ,  sP2FieldName,  sP3FieldName  to sP20...
dim i as integer
i = 1

Do While i < 21
 sCurrValue = getDateField(i)
   ' getDateField() is a function that gets the date for field 1 this all works correctly
   ' now I want to recreate the correct variable that I created above with the text
   'and the i number

 "sP" & str(i) & "FieldName"  = sCurrValue  'This is where I am having the problem

   i = i + 1
   Loop

Thank you experts

ASKER CERTIFIED SOLUTION
NotLogical

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros