I find that the easiest way to sort/group by different ways on a report
is to base the report on a query
ie:
SELECT [fieldname1] as [Sort1]
, [fieldname2] as [Sort2]
, [fieldname3]
, [fieldname3]
FROM [tablename]
etc
~~~
use a form to collect the report critera and the sort method. Then, on
the button to process the report, replace the query it is based on
before you open it
'~~~~~~~~~~~~~~~~~~~~~ MakeQuery
Sub MakeQuery( _
ByVal pSql As String, _
ByVal qName As String)
'modified 3-30-08
'crystal
'strive4peace2008 at yahoo dot com
On Error GoTo Proc_Err
debug.print pSql
'if query already exists, update the SQL
'if not, create the query
If Nz(DLookup("[Name]", "MSysObjects", _
"[Name]='" & qName _
& "' And [Type]=5"), "") = "" Then
CurrentDb.CreateQueryDef qName, pSql
Else
'if query is open, close it
on error resume next
DoCmd.Close acQuery, qName, acSaveNo
On Error GoTo Proc_Err
CurrentDb.QueryDefs(qName).sql = pSql
End If
Proc_exit:
CurrentDb.QueryDefs.Refresh
DoEvents
Exit Sub
Proc_error:
MsgBox Err.Description, , _
"ERROR " & Err.Number & " MakeQuery"
Resume Proc_Exit
'if you want to single-step code to find error, CTRL-Break at MsgBox
'then set this to be the next statement
Resume
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~~
to use the MakeQuery procedure, put this in your code:
MakeQuery strSQL, "YourQueryName"
Warm Regards,
Crystal
remote programming and training
Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace
*

have an awesome day

*
The boss wants to be able to sort a report before he prints it. It
needs to sort by either Area, School District, Plan Type, or Project
Approval. Is there a way to put a combo or something to allow him to
pick his sort? Thanks a bunch!!!