Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004

    Unanswered: Get Checkbox information in a report

    I have a form that along with a number of other things, it has checkboxes the user can check. They can check none, one or all of them. I'm having trouble figuring out a way to display the information from the checkboxes in a report without taking up a lot of room.

    I'd like to have a control (text Box) in the report that will list all the corresponding information from the checked, checkboxes and expand if needed when many boxes were checked.

    Lets say I have checkboxes next to the seven days of the week. The user can check just one day, two days or all seven days. In the report, there would be a label indicating Day(s) and then a list of the days that were checked, separated by a comma.

    Day(s): Monday, Wednesday, Saturday
    Day(s): Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

  2. #2
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    You're going to have some problems with the "seperated by a comma" thing.

    You'll have to use VBA for that.

    Something like:
    Dim s As String
    Dim frm As Form
    Set frm = forms!yourForm
    If Not IsNull(frm!chkMonday) Then
       s = "Monday "
    End If
    If Not IsNull(frm!chkTuesday) Then
       If IsNull(s) Then
          s = s & ", "
       End If
       s = s & "Tuesday"
    End If
    etc etc

    If you gave your boxes a numeric naming scheme, you could do this all with one for loop and a select case statement.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Dec 2003
    Dallas, TX
    Hey RShoe,

    I have a Form that has CheckBoxes for the Priority I wish to Low, Medium and High. On the Report I drag/drop the Priority field on the report, and on it's properties check Invisible/YES. Next I place an Unbound TextBox on the report that says Level, which will be the Priority Level. THEN, still in ReportDesignView, double-click on the Details bar to bring up its properties. In the Properties box that pops up, click on the EventsTab and then click on the OnPrint section and on the ellipses(....) NOW, place this code inside and your done:

    Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    'Created by Carlton Edwards 1-26-2004.
    'Reflects the real value of the Priority field. My FIRST Select
    'Case statement ever done.
        Const conNormal = 400
        Const conHeavy = 900    'Extra bold
        Const conSmall = 8
        Const conLarge = 12
    Select Case Priority
        Case 1
            Level = "Low"
            Level.FontWeight = conNormal
            Level.FontSize = conSmall
        Case 2
            Level = "Medium"
            Level.FontWeight = conNormal
            Level.FontSize = conSmall
        Case 3
            Level = "HIGH"
            Level.FontWeight = conHeavy
            Level.FontSize = conLarge
        Case Else
            Level = ""
        End Select
    End Sub
    What that code does is places the words Low, Medium and High in the Report, ONLY if it is checked on the form, otherwise it shows Blank. Also I set the fonts to print the HIGH in BOLD. Thats about it.

    hope this helps you out some. And I know it works because I just pulled it from my database that tracks minutes of the meetings we have here.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts