• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

How do you create Radio Buttons in Access

I need to create three radio buttons on a form.  Each will print a different report.

I've never done this so please provide step by step procedures.
0
J.R. Sitman
Asked:
J.R. Sitman
  • 4
  • 2
  • 2
  • +2
3 Solutions
 
hnasrCommented:
Add Option group control to form - wizard starts
Add labels to option buttons
    report1
    report2
    report3
No default.
Values
    report1   1
    report2   2
    report3   3
Save values for later use
Option Buttons
Caption: Print Reports
Properties sheet: change name: printReports
   Event: After update
Private Sub printReports_AfterUpdate()
    Select Case printReports
        Case 1
            'print report1
        Case 2
            'Print report2
        Case 3
            'print report3
        End Select
End Sub

Open in new window

0
 
Dale FyeCommented:
Putting the buttons in an option group (frame) will only allow you to click one of them at a time.

You may prefer to allow your users to run all three reports at one time and use a command button to initiate the printout based on whic items selected.  You can use option buttons without the frame by simply dropping them on your form, but if you want to allow multiple reports to be printed at the same time, I would generally use checkboxes rather than radio buttons
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I'd agree with Dale regarding the use of Option Buttons (i.e. Radio Buttons). Radio Buttons, Checkboxes, etc are very common UI tools, and users expect them to behave in a certain way. If you make them do something they're not accustomed to - like using multiple Radio Buttons to allow for multiple choices - then you run the risk of a confusing interface.

According to most usage guides, Radio Buttons should be used when the user must make one (and only one) choice - like selecting Gender, for example.

If a user could choose one or more from a group of choices, you should instead use CheckBoxes.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
J.R. SitmanAuthor Commented:
Got it designed, except nothing happens when I select one of the buttons.  How do you get it to print?
0
 
PatHartmanCommented:
DoCmd.OpenReport ..........

Intellisense will guide you through the rest.  If you don't understand an option, use help.
0
 
J.R. SitmanAuthor Commented:
sorry, I don't understand.  I copied code from another print event and it doesn't work.. Can you edit it please?  

    Select Case optiontreatment
        Case 1
            'print rpttreatmentsadopters
            'DoCmd.OpenReport rpttreatmentsadopters
        Case 2
            'Print rpttreatments
            stDocName = "rptTreatments"
    DoCmd.OpenReport stDocName, acPreview, wherecondition:="[SoftSlip] = '" & Me.SoftSlip & "'"
   
    DoCmd.PrintOut Copies:=1
    DoEvents
    DoCmd.Close acReport, "rptTreatments"
        Case 3
            'print rpttreatmentsbilling
        End Select
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Do you have an Option Group named "optiontreatment"? The code above basically looks at the value of that option group, and takes action accordingly. The only Option Group item that would cause a Print is Option 2 (whatever that is). If you have anything other than Option 2 selected in the optiontreatment group, the code would do nothing.
0
 
J.R. SitmanAuthor Commented:
got it.
0
 
J.R. SitmanAuthor Commented:
Thanks
0
 
hnasrCommented:
Welcome!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now