B
Brandon J. Acquaviva
I have a user form that will have OptionButtons added dynamically from
a database. That part is fine as I have this part working. Now i
need to know how to create an event handler that will change the
content of a text box (txtInfo) when the option buttons are clicked.
The value that will fill the textbox will be pupulated from the
database as well.
'************************************************************
' ADD THE OPTION BUTTONS
TopPos = 4
MaxWidth = 0 'Stores width of widest OptionButton
Do While Not objRS.EOF
Dim TempID As String
TempID = "Temp" & objRS("id_no")
If objRS("template_version") = 0 Then
strCaption = objRS("template_name")
Else
strCaption = objRS("template_name") & " - REV " &
objRS("template_version")
End If
Set optTemplates = Controls.Add("forms.OptionButton.1")
With optTemplates
.Width = 200
.Caption = strCaption
.Enabled = objRS("template_enabled")
.Height = 15
.Left = 8
.Top = TopPos
.AutoSize = True
.Accelerator = objRS("template_accelerator")
.Value = objRS("template_default")
End With
TopPos = TopPos + 15
objRS.MoveNext
Loop
a database. That part is fine as I have this part working. Now i
need to know how to create an event handler that will change the
content of a text box (txtInfo) when the option buttons are clicked.
The value that will fill the textbox will be pupulated from the
database as well.
'************************************************************
' ADD THE OPTION BUTTONS
TopPos = 4
MaxWidth = 0 'Stores width of widest OptionButton
Do While Not objRS.EOF
Dim TempID As String
TempID = "Temp" & objRS("id_no")
If objRS("template_version") = 0 Then
strCaption = objRS("template_name")
Else
strCaption = objRS("template_name") & " - REV " &
objRS("template_version")
End If
Set optTemplates = Controls.Add("forms.OptionButton.1")
With optTemplates
.Width = 200
.Caption = strCaption
.Enabled = objRS("template_enabled")
.Height = 15
.Left = 8
.Top = TopPos
.AutoSize = True
.Accelerator = objRS("template_accelerator")
.Value = objRS("template_default")
End With
TopPos = TopPos + 15
objRS.MoveNext
Loop