Question : Radio Button Centering in Access Report

I'm having trouble trying to get the dot inside a radio button(ie a populated radio button) centered on reports. Any suggestions? I'm using Access version 2002. If necessary, I can attach an .mdb example.

Many thanks
Attachments:
 
Screenprint of Access Report
Screenprint of Access Report
 

Answer : Radio Button Centering in Access Report

I agree, radio buttons are ugly when printed. Alternatives:

 • Using symbols in the format property of a yes/no expression,
 • using images (more complex),
 • drawing the circles using the Me.Circle method,
 • refrain from printing radio buttons.

For the first solution, try to find two symbols in available fonts that could pass for the empty circle and the filled circle. If you find something you like, we can show you how to use them in a text box linked to an expression based on your field.

I can understand the idea to print something that looks and feels like the on-screen form, but it would look much better with a more traditional layout.

For example, spell out “yes” or “no”, print only the option that's been selected, etc. You can also place a rectangle around the selected item, bold it and grey out the other, or use colours depending on the final destination of the report.
____________________

The code below implements the second idea: using Me.Circle. It's the entire module of a report: the function OldRadio will draw the circles to mimic the option buttons. For this to work, make the option buttons invisible; the function will use the control metrics to draw a circle of the selected size (make the boxes of the controls larger to draw larger circles). Since the option buttons are invisible, their labels will be also. You need to detach the labels from the controls (cut and paste on the section works nicely).

The call is made from all sections containing option buttons, the example is for the detail section only.

Good luck!
(°v°)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
Option Explicit

Private Function OldRadio(psec As [_SectionInReport])
    
    Dim ctl As Control
    Dim lngCX As Long
    Dim lngCY As Long
    Dim lngRad As Long
    
    For Each ctl In psec.Controls
        If ctl.ControlType = acOptionButton Then
            lngCX = ctl.Left + ctl.Width / 2
            lngCY = ctl.Top + ctl.Height / 2
            lngRad = ctl.Width / 2
            ' draw circle
            Me.FillStyle = 1   ' transparent
            Me.Circle (lngCX, lngCY), lngRad
            Me.FillStyle = 0   ' opaque
            If ctl.Value = True Then
                Me.FillColor = vbBlack
                Me.Circle (lngCX, lngCY), lngRad / 2
            ElseIf ctl.Value = False Then
                ' nothing
            Else   ' Null
                Me.FillColor = RGB(153, 153, 153)
                Me.Circle (lngCX, lngCY), lngRad * 3 / 4, vbWhite
            End If
        End If
    Next ctl
    
End Function

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    OldRadio Detail
End Sub
Random Solutions  
 
programming4us programming4us