Using VB to check field information

  • Thread starter Thread starter Mike Waters
  • Start date Start date
M

Mike Waters

Hello,
I have a database that has a series of fields name
loc_01 through loc_24. I can write a vb script that
checks the fields to see what is in them, and then based
on what it finds does something else. What I am trying
to do now though is to use a loop that would
automatically go through all the fields. What I had
tried was something like the following, but can't seem to
get it to work:
Do while count < 24
loc1="loc_0" +right(str(count),1) 'this was needed to
eliminate a blank space in the name
loc1.setfocus 'here is where I get the error.


I have more code then that,but this is the part I'm
having trouble with. Is it possible to get a loop to do
what I want it to do, and if so, can someone help me
figure it out. Please let me know.

Thank You,
Mike
 
Thanks for the URL. I have it half working now using the
info I found there. The problem I know have is that once
it hits 10 I get an error. I wasn't thinking, the names
go from loc_01 to loc_09, then loc_10 to loc_24. I could
do 2 for loops, but is there a way to get the integer to
show as a double diget? I should know this, but I can't
seem to remember how to do it.

Mike
 
Thanks for the suggestion. I'll have to try it.
-----Original Message-----
For intLoop = 1 To 24
strFieldName = "loc_" & Format$(intLoop, "00")
....

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)






.
 
Back
Top