Re: Dynamic Creation of Option Group
- From: Marshall Barton <marshbarton@xxxxxxxxxx>
- Date: Wed, 28 Feb 2007 11:57:28 -0600
Grwffyn wrote:
I have an application that requires a matrix of option buttons that changes
based on a table.
So far, I have a method of creating a collection that identifies each item,
but have not been able to make the item into an option button. Is this
possible?
For intX = 0 To intTotal
For intY = intX To intTotal
strX = Format(intX, "00")
strY = Format(intY, "00")
ctlArray(intX, intY) = "ctl" & strX & "_" & strY
colRadio.Add (ctlArray(intX, intY))
Next intY
Next intX
For Each newRadio In colRadio
newRadio.Left = Me.WindowLeft + 720
newRadio.Top = Me.WindowTop - 720
newRadio.ControlType = acOptionButton
Next
This code dies at the "For Each newradio in colRadio" with "Run-time error
'424': Object required.
That's too vague and out of context for me to answer with a
specific suggestion.
A general approach is to precreate all potentially needed
controls with names like ctl03_07. The controls can then be
referenced using this kind of syntax:
Me("ctl" & intX & "_" & intY)
Then instead of whatever your code is trying to do, just
make the needed controls Visible and adjust the Top and Left
properties.
--
Marsh
MVP [MS Access]
.
- Prev by Date: Re: Sending Printer commands
- Next by Date: Re: Exclusive Access Conflict
- Previous by thread: Re: Sending Printer commands
- Next by thread: Re: Exclusive Access Conflict
- Index(es):
Relevant Pages
|