Re: Dynamic Creation of Option Group

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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]
.



Relevant Pages

  • Re: Manipulating dates
    ... Add 8 unbound text controls to your report. ... Space them using Format + Horizontal Spacing Make Equal. ... Dim intX As Integer ... Dim intY As Integer ...
    (comp.databases.ms-access)
  • Re: Manipulating dates
    ... Add 8 unbound text controls to your report. ... Space them using Format + Horizontal Spacing Make Equal. ... Dim intX As Integer ... Dim intY As Integer ...
    (comp.databases.ms-access)
  • Re: Displaying controls as separated values in boxes on a report
    ... I need to get the T in a box or put a border round it, then the R etc etc etc. ... Add 16 unbound text controls to your report. ... Dim intX As Integer ... Dim intY As Integer ...
    (microsoft.public.access.reports)
  • Re: Displaying controls as separated values in boxes on a report
    ... I need to get the T in a box or put a border round it, then the R etc etc etc. ... Add 16 unbound text controls to your report. ... Dim intX As Integer ... Dim intY As Integer ...
    (microsoft.public.access.reports)
  • Re: Counting number of line in a memo field
    ... Dim intX As Integer ... Dim intY As Integer ... Then call it from a query: ... >From a Report you would use an unbound control. ...
    (microsoft.public.access.formscoding)