Results 1 to 2 of 2
2005-11-20, 05:04 #1
- Join Date
- Jan 2001
- Pennsylvania, USA
- Thanked 0 Times in 0 Posts
Top_N_Value Query-Report (2000/2002)
Is there a way to change the TopValue value in a Top_N_Value Query or Report using a Dialog Form.
Something like: From the Dialog Form I select a Supplier, Date Range, TopValue=5 at this time, and later the user may want to see TopValue=15threecrow
Don't make excuses. It's what you do, not why you didn't.
2005-11-20, 09:59 #2
- Join Date
- Mar 2002
- Thanked 30 Times in 30 Posts
Re: Top_N_Value Query-Report (2000/2002)
Sort the report the way you want in the Sorting and Grouping window.
Put a text box in the detail section of the report.
Set its Control Source to =1
Set its Running Sum property to Over all.
Set its name to txtCounter.
Create the following On Format event procedure for the Detail section of the report:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = (Me.txtCounter > Val(Forms![frmDialog]![txtTopN]))
where frmDialog is the name of the dialog form, and txtTopN is the name of the text box (or combo box, or list box) in which the user specifies the number of records to be displayed.
You may want to leave txtCounter visible during testing, and hide it by setting Visible to No in the definitive version.