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

pairs of 10 buttons 1

Status
Not open for further replies.

matrixindicator

IS-IT--Management
Sep 6, 2007
418
BE
Perhaps a basic logical thinking question. Code below is working (fine), I create buttons on a form in rows of then. I mean this is working fine if I have 10, 20 or a few more buttons.
If I have 30 or 40 buttons, he set the first 10 correct, the 20 next also correct under the 10, but more then he paste the rest on the second row

Code:
one row of 10 buttons
second row of 10 buttons
third row of 10 buttons
...

Code:
t = 100
l = 100
rst.MoveFirst
Do Until rst.EOF
Set EigenControl = CreateControl(frm.Name, acCommandButton, , , , l, t, 1000, 1000)
If tnr > 9 Then
t = 1200
   If tnr > 10 Then
   Else
   l = 100
   End If
Else
End If
tnr = tnr + 1
rst.MoveNext
Loop
 
How are ya matrixindicator . . .

Your problem is your not setting [blue]l & t[/blue] relative to their previous values properly. Try the following:
Code:
[blue]   t = 100
   l = 100
   ctr = 0
   rst.MoveFirst
   
   Do Until rst.EOF
      Set EigenControl = CreateControl(frm.Name, acCommandButton, , , , l, t, 1000, 1000)
      ctr = ctr + 1
      
      If ctr Mod 10 = 0 Then [green]'Start New Row![/green]
         ctr = 0
         t = t + 1100
         l = 100
      Else [green]'Continue Row.[/green]
         l = l + 1100
      End If
      
      rst.MoveNext
   Loop[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Not tested already, but I have the feeling that is works (use of the Mod function).

One of these coming days I am gone try this. Perhaps a bit "risky", in the meantime thanks already for your support and effort TheAceMan1!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top