Report design change at run time

promod33

New member
Local time
Today, 19:40
Joined
Mar 26, 2006
Messages
7
I am generating a report in MS-Access which has many fields. I want to sort the report by different fields at run time, but do not know how ? At design time,I am able to set the different sort by order field name.

Any help will be appreciated.
 
You can make a tiny form that displays 'modal' in front of the report. Get as fancy as you want, but this is the basic kind of code you need...
Code:
Private Sub Command10_Click()
    With Reports!report2
        .OrderBy = "pname"
        .OrderByOn = True
    End With
End Sub
 
Hi,
Thanks for reply.

I followed your instruction. Now,I have modified codes as below :

Private Sub cmdOpenReport_Click()
DoCmd.OpenReport "rptTraining", acPreview
End Sub

Private Sub cmdSortReport_Click()
Report!rptTraining.OrderBy = "TrainingDate"
Reports!rptTraining.OrderByOn = True
End Sub

The report opens with first command button with default sorting field. But, there is no affect of second command button. No error messages comes.

Is there any way to refresh the report ? I think, once report is loaded ,it is not getting refreshed.

regards.
 

Users who are viewing this thread

Back
Top Bottom