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!

CONTROL ARRAYS 1

Status
Not open for further replies.

franks

Programmer
Aug 16, 2001
9
ES
Hi
I need to do the following for 15 different txtboxes.
Basically I´d like to run a loop like this
for i=1 to 15
GRUPO1.Value = DLookup("[GRUP_DETA]", "GRUPOS", "[GRUP_CODI] = [CLIE_GR01]")
next i

but I need to change the GRUPO1.value to be GRUPO2, GRUPO3, etc as well as the last field, CLIE_GR01, CLIE_GR02, etc

Is there a way to do this using Me.controls("GRP" & i) ???
I just don´t know how to use one with the other (if it is possible).

Thanks and regards
Frank
 
Hi Frank!

Use this code:

Dim strControlName As String
Dim strCriteria As String

for i=1 to 15
strControlName = "GRUP" & Format(i, "00")
strCriteria = "[GRUP_CODI] = [CLIE_GR" & Format(i, "00") & "]"
Me.Controls(strControlName)= DLookup("[GRUP_DETA]", "GRUPOS", strCriteria)
next i

That should get you what you want, though I haven't tested it.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Thanks mate !
That's exactly what I was looking for !
I've tested it yet (the mDB is in the office) but it looks like what I am after !!!

Thank you so much !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top