Home | Business and Productivity Software | Is it possible to use...
Business and Productivity Software
Problem for Business and Productivity Software
Generic problem for all Business and Productivity Sof...

Is it possible to use a variable exp...




By Bushtrekker on Sep 12, 2008

" "
I want to place 100 different values for 100 different labels on a form. I can do it simply with the following loop, but VBA won't accept any syntax I have tried for the label name.
For CT = 1 to 100
[Forms]![F3-subject index]!["sn"&CT].Caption=valuearray(CT)
next CT
How can this loop be accomlished?
Comments:

Sep 12, 2008

- The solution didn't seem to address my problem

Sep 12, 2008

- This solution relates to excel. I am working with labels on an access form. Can my loop be performed in VBA or DAO for access? If so, what is the syntax?

Sep 12, 2008

- I already spent a day searching various forums and links such as the one you suggest. They do not address the particular question: "Can a variable be used in VBA to designate the label name on a form? If so, what is the syntax? IF not, can it be done in DAO? If so, what is the syntax?

Sep 12, 2008

- Coolguy008 suggests:
Dim lbl as label
lbl.Caption = "string"
[Forms]![F3-subject index]![sn5] = label
But, "sn5" in your solution is not a variable. I want to use a variable in the place of [sn5]. If this is a solution, you'll have to explain it to me.

Sep 12, 2008

- Yes, Suben, that is exactly what I did. But, that syntax doesn't work.

Solution #1

posted on Sep 12, 2008
Somewhat Helpful)

abhishek33

Rank: Wiz 
Rating: 75%, 427 votes
    • hi,,
    •  u could find the link.. for label name..
    • www.functionx.com/​vbaccess/​Lesson09.htm
    •  
        thank u sir..

Was this helpful?
Yes
No

Solution #2

posted on Sep 12, 2008
Somewhat Helpful)

suben

Rank: Wiz 
Rating: 81%, 155 votes
try this
Dim lbl as label
lbl.Caption = "string"
[Forms]![F3-subject index]![sn5] = label

hope it works


Comments:

Sep 12, 2008

- or this
[Forms]![F3-subject index]!["sn"&CT].Caption=valuearray(CT)
next CT

Was this helpful?
Yes
No

Solution #3

posted on Sep 12, 2008
Somewhat Helpful)

mohammed387

Rank: Wiz 
Rating: 77%, 832 votes



download tis software and use it
Financial Excel All Programs Complete Edition

then check ur loop is correct in syntax

use tis below links for tutorial

http://www.lacher.com/toc/tutvba1.htm

http://www.blueclaw-db.com/access_createquerydef.htm





Was this helpful?
Yes
No

Solution #4

posted on Sep 12, 2008
Somewhat Helpful)

coolguy008

Rank: Wiz 
Rating: 83%, 565 votes
HI,

Please click on the below link and go through the post.It will help you fix your problem.

http://www.dailydoseofexcel.com/archives/2006/12/04/writing-to-a-range-using-vba/

Comments:

Sep 12, 2008

- Please don't forget to accept the solution as fixya.

Sep 12, 2008

- Please don't forget to accept the solution as fixya.

Sep 12, 2008

- ok..please try out this syntax

Dim lbl as label
lbl.Caption = "string"
[Forms]![F3-subject index]![sn5] = label

I hope this will help and please don't forget to accept my solution.

Sep 12, 2008

- Did you already try this:

Dim lbl as label
lbl.Caption = "string"
[Forms]![F3-subject index]![sn5] = label

Was this helpful?
Yes
No

Solution #5

posted on Sep 12, 2008
Not Rated)

maklean

Rank: Guru 
Rating: 86%, 636 votes
Have a look at some relative questions
Was this helpful?
Yes
No

Popular Solutions for Business and Productivity


Questions and Unsolved Problems for Business and Productivity


Answer
I have XP and QuickBooks Pro 2007. QuickBooks PDF Converter shows up with my printers, but when I... (More)

Answer
ddy79-433jv-2rxgx-mqfqp-pfdh8 The above code worked. I had used Magic Jelly Bean but it only gave me... (More)

Answer
is textbridge 98 compatible with vista please?

Answer
how to integrate zinc6.1 with Tornado 2.2 IDE


Didn't find what you were looking for?

Describe your problem:

Select a Category:





Sponsored Links



Ask our Experts

 

Solve Your Problem Now!
Chat Live with an Expert
Chat Now
Browse popular Problems
More Common Problems
Most Common Problems for:
For Business and Productivity...:

Top Business and Pro... Experts

Rank: Guru Guru  

Solutions: 437
Member Since: October 2009

Experience: Experienced a lot in computer troubleshooting. Knowledgeable about cellular phones.

Ask Me
Find more Business and Pro... Experts

Top Computer & Laptop Repair

(952) 890-7770
Zkarlo.com provides discount and used laptop parts...
Zkarlo.com

(513) 874-3306
We fix and repair laptop motherboard no video, no...
LaptopOnCall Inc.


       
Solve Your Problem Now!
Chat Live with an Expert
Chat Now

X
Continue
When the original poster rates a solution that was given to his own problem, that rating is locked!
X

Are you sure the solution content is Inappropriate?
   
Tech buddies can communicate directly to answer questions. Become a Tech Buddy and have direct access to your favorite expert for FREE!
Insert Link
Insert Image
Insert You-Tube clip
Insert List
Insert List
Spell Check

What is this?



Select