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

referencing field length in for loop

Status
Not open for further replies.

priapus

Technical User
May 17, 2001
26
US
Uhhh...Fairly simple question, I just can't figure it out. I have this for loop where the first line is something along the lines of

For Each MyCharacter in Me![MyComboBox].Length

Only the Me![MyComboBox].Length is invalid syntax (there's no .length function). What's the correct way to reference a form field's length in a for loop?
 
Dim intCtr As Integer
For intCtr = 1 To (Me.MyComboBox)
...
Next intCtr

Steve King

Growth follows a healthy professional curiosity
 
you can get the length with the Len function

Len(Me![controlname])


Dave
 
Good catch Dave. I really meant to say:

For intCtr = 1 To Len(Me.MyComboBox)

Just another example of why it's important to have peer review or do testing.

Steve King
Growth follows a healthy professional curiosity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top