Heading rather than detail

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I have data on a form that looks like this

NAME GROUP RESPONSE AG
Tommy Beds yes 5
Tim Beds no 4
Uncle Carpets yes 4
Sasquash Carpets yes 4
Hermie Carpets no
NoBrain Floors no 1

i.e. in the design view I have the labels ("NAME" etc as the form header) and a single textbox for each field in the detail

What I would like to see is this

NAME RESPONSE AG

BEDS
Tommy yes 5
Tim no 4

CARPETS
Uncle yes 4
Sasquash yes 4
Hermie no

FLOORS
NoBrain no 1

Now, I am aware that you cannot do grouping in a form as you could in a report, but is there any other way I could achieve this? I'd rather not use loads of subforms if I don't have to. (This form is actually a subform looking at multiple companies whose data is held on the same tables)

Thanks loads

Mike
 
1. Open your report in design view.

2. Open the Sorting'n'Grouping dialog (View menu).

3. Enter the Group field, and in the lower pane of the dialog set Yes for
Heading. Access adds a new section to the report.

4. Drag the "Group" text box up into the new heading section.

5. Reorganise the other fields as desired.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Mike said:
I have data on a form that looks like this:

NAME GROUP RESPONSE AGE
Tommy Beds yes 54
Tim Beds no 42
Uncle Carpets yes 44
Sasquash Carpets yes 48
Hermie Carpets no 5
NoBrain Floors no 12

i.e. in the design view I have the labels ("NAME" etc as the form header)
and a single textbox for each field in the detail.
What I would like to see is this:

NAME RESPONSE AGE

BEDS:
Tommy yes 54
Tim no 42

CARPETS:
Uncle yes 44
Sasquash yes 48
Hermie no 5

FLOORS:
NoBrain no 12

Now, I am aware that you cannot do grouping in a form as you could in a
report, but is there any other way I could achieve this? I'd rather not use
loads of subforms if I don't have to. (This form is actually a subform
looking at multiple companies whose data is held on the same tables).
 
It's not a report - it's a form - hence there is no grouping (I wish there bloody was!)

Any ideas how to do this on a form

----- Allen Browne wrote: ----

1. Open your report in design view

2. Open the Sorting'n'Grouping dialog (View menu)

3. Enter the Group field, and in the lower pane of the dialog set Yes fo
Heading. Access adds a new section to the report

4. Drag the "Group" text box up into the new heading section

5. Reorganise the other fields as desired

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.htm
Reply to group, rather than allenbrowne at mvps dot org

Mike said:
Tommy Beds yes 5
Tim Beds no 4
Uncle Carpets yes 4
Sasquash Carpets yes 4
Hermie Carpets no
NoBrain Floors no 1
Tommy yes 5
Tim no 4
Uncle yes 4
Sasquash yes 4
Hermie no
NoBrain no 1
report, but is there any other way I could achieve this? I'd rather not us
loads of subforms if I don't have to. (This form is actually a subfor
looking at multiple companies whose data is held on the same tables)
 
Sorry, Mike: you did say that.

No. No simple way to achieve that in a form.
Presumably it is not satisfactory to use a subform where the main form
selects the category (group) and the subform displays just the items for
that group.

Another possibility might be to hightlight the first Group by setting its
BackColor differently. Conditional Formatting can do that if you can get a
way to determine whether the Group is the same as on the preceeding row. You
could do that by adding a text box to the form, with Control Source set to:
=GetPreviousValue([Form], "Group")

Function GetPreviousValue(frm As Form, strField As String) As Variant
On Error GoTo Err_Handler
'Purpose: Return the value from the previous row of the form.
Dim rs As DAO.Recordset

Set rs = frm.RecordsetClone
rs.Bookmark = frm.Bookmark
rs.MovePrevious
GetPreviousValue = rs(strField)

Set rs = Nothing
Exit_Handler:
Exit Function

Err_Handler:
If Err.Number <> 3021& Then 'No current record
Debug.Print Err.Number, Err.Description
End If
GetPreviousValue = Null
Resume Exit_Handler
End Function
 
Back
Top