0
Name

henry
james
larry

Hello everyone I am trying to take the length of a column using vba- access so that I can loop through each value in the column but I can not find any resource online which points this out I was thinking it would be something like this:

for (i= 1 to Name.Count)

next
Erik A
  • 31,639
  • 12
  • 42
  • 67
CaptainKid
  • 57
  • 2
  • 2
  • 9
  • possible duplicate of [Looping through recordset with VBA](http://stackoverflow.com/questions/2579290/looping-through-recordset-with-vba) – RubberDuck May 26 '14 at 17:15

1 Answers1

-1

To return the length of a string in VBA, you can use Len(String). If you want to return the length of a string within a column in a query, you can use Len([ColumnName]).

VBlades
  • 2,241
  • 1
  • 12
  • 8
  • OP is trying to loop through the recordset; not get the string length. – RubberDuck May 26 '14 at 17:16
  • That wasn't his question. How if he wanted to loop through each character of a string for each record in the recordset? – VBlades May 27 '14 at 01:10
  • "So that I can loop through each value in the column" – RubberDuck May 27 '14 at 02:05
  • Yes: "So that I can loop through each value in the column". Looping through each value in a column is not the same as traversing the recordset itself. You could traverse a recordset without ever referring to the values in its fields. – VBlades May 27 '14 at 03:37
  • I am trying to loop through the record set not the string. – CaptainKid May 27 '14 at 19:17