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

quick for loop help/suggestion needed 1

Status
Not open for further replies.

MFFL

Vendor
Nov 20, 2002
26
US
this what i had and worked:

Me.lblNone1.visible = false '... to lblname10
Me.reqPref1.Caption = "" '... to reqPref10
Me.ComboReq1 ="" '... to ComboReq10
and so forth...

This is what i thought I should change to:

Dim i As Integer

For i = 1 To 10
Me("lblNone" + i).Visible = False
Me("reqPref" + i).Caption = ""
Me("relPref" + i).Caption = ""
Me("ComboReq" + i) = ""
Me("ComboRel" + i) = ""
i = i + 1
Next

My error: Error 13, Type Mismatch

I tried switching (Me) lines within the For loop around and no matter what (Me) line first that is the one that causes error. I know I must be overlooking something simple, but i need another set of eyes.

As always, any help, thought, suggestion is appreciated MMFL-
Mavericks Fan For Life
 
Hi

You should be using & for concatenate not +

So :

For i = 1 To 10
Me("lblNone" & i).Visible = False
Me("reqPref" & i).Caption = ""
Me("relPref" & i).Caption = ""
Me("ComboReq" & i) = ""
Me("ComboRel" & i) = ""
i = i & 1
Next

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
loose the line:

i = i & 1

It willl cause the loop to skip the ven numbered controls.



MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Actually, even that is el wrongo, as Ken has already changed the addition to concatenation ("+" ==> "&"), so a different error will occur (but you STILL need to loose it).


MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Hi

OOPS!! yes did not notice that, that is what you get for a quick find and replace

well spotted Michael Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thanks fellas, really, thankyou both.
I knew it was something obvious, I guessed I had worked so long yesterday I worked to the point of unproductivity.
MMFL-
Mavericks Fan For Life
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top