UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Option Button    
 
   
mac_baum
post Aug 15 2008, 08:18 AM
Post #1

UtterAccess Enthusiast
Posts: 76
From: Canada



There seems to be two types of Option Buttons in a form - one within an acOptionGroup another stand alone. The one in the acOptionGroup has no Validation Text while the other does.

Here is the situation. I have an extractiion engine that automatically extracts the Validation Text from objects in a selected form. When the engine attempts to extract Validation Text from the Option Button within an acOptionGroup, I of course get an error.

Is there any way of distinguishing between the two?

Thanks
Go to the top of the page
 
+
Doug Steele
post Aug 15 2008, 09:40 AM
Post #2

UtterAccess VIP
Posts: 17,620
From: Don Mills, ON (Canada)



Check the name of the Parent of the control. It'll either be the name of the form (for stand-alone) or the name of an option group.

CODE
Dim ctlCurr As Control
Dim strMessage As String
  
  For Each ctlCurr In Me.Controls
    If ctlCurr.ControlType = acOptionButton Then
      If ctlCurr.Parent.Name = Me.Name Then
        strMessage = strMessage & ctlCurr.Name & " is stand-alone." & vbCrLf
      Else
        strMessage = strMessage & ctlCurr.Name & " is in control group " & ctlCurr.Parent.Name & vbCrLf
      End If
    End If
  Next ctlCurr
  
  If Len(strMessage) > 0 Then
    MsgBox strMessage
  Else
    MsgBox "No option buttons found on the form"
  End If
Go to the top of the page
 
+
mac_baum
post Aug 15 2008, 10:38 AM
Post #3

UtterAccess Enthusiast
Posts: 76
From: Canada



Thanks for the solution. Works like a charm.
Go to the top of the page
 
+
mac_baum
post Aug 15 2008, 01:04 PM
Post #4

UtterAccess Enthusiast
Posts: 76
From: Canada



djsteele,

Sorry but I was a bit too hasty in my accepting the solution. On further testing I found that suggestion did not work. Your code is fine. I tested it as is in another form.

The extraction engine runs in a module called from another form. The code looks like this

For Each ActiveObject in ActiveForm

Select Case ActiveObject.ControlType
.
.
.
Case acOptionButton
Extract "StatusBarText"
Extract "ValidationText"
.
.
.
End Select

All other extractions work fine except the OptionButton which gives a run-time error 2455.

I tried trapping for that error. It traps on the first occurence of this error but not the next.

Any ideas?
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 21st May 2013 - 04:19 AM