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: Master 
Rating: 76%, 466 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%, 164 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: Master 
Rating: 77%, 898 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  Computers & Networking  Expert
Rating: 83%, 624 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  Computers & Networking  Expert
Rating: 86%, 654 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 need to purchase a software programme that will enable me to scan or draw plans of buildings and... (More)

Answer
i have a word file with flow chart which is made by visio software does not open in another... (More)


Didn't find what you were looking for?

Describe your Business and Productivity... problem:

Select a Category:





Related Products & Issues:



Ask our Experts

 

Solve Your Problem Now!
Chat Live with an Expert
Chat Now
Top Business and... Experts



Top Computer & Laptop Repairmen
in Colton, CA
(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

Insert Link
Insert Image
Insert You-Tube clip
Insert List
Insert List
Spell Check

What is this?



Select


close

Add to My Products

Add the things you own to your My Products collection and get product information, solutions to problems, manuals & guides, tips and how-to's, reviews & ratings and local repair service - all in one easy place.


Step 1: Select a category & subcategory

Appliances Cameras Cars Computers Electronics Home Audio TV & Videos Tools
Appliances Cameras Cars Computers Electronics Home Audio TV & Video Tools
 
Step 2: Select a product and click on add
I can't find my product

select

Cancel
close
Success!

Add another product
Close
close
Save This Product

Enter your email address

We will not share your email. Privacy Policy

I agree to the FixYa Terms of Use

    
Send to friends
Send to: (e.g. Julie@email.com)
(Separate email adresses with commas)
Your name:
Your email address:
Message: