reports: query

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

Guest

I created a report. The main information is in a grouped header (not in
detail band) For each group about 10 records appear but i only want the first
4 records to appear - is there anyway of doing this?
 
Another method uses a single report and a little code.

-Add a text box to the detail section
Name: txtCountGroup
Control Source: =1
Running Sum: Over Group
Visible: No
-Add code to the On Format event of the detail section
Cancel = Me.txtCountGroup>4
 
Hi Duane I think i'm on the right track with what you said until i get to the

Cancel = Me.txtCountGroup>4

The database says something like it doesn't recognise the Cancel = me macro.
Am i putting it in the correct place? The records that i want are in a
customer id header so i put the txtcountgroup text box in that header and did
all the properties that you wrote, i then double clicked on the customer id
header band, right clicked, went to properties and clicked on the 3rd tab
Event tab and pasted the count formula there in the row of onformat - is that
correct? because it didn't work! Thanks for your time
 
Where are you putting this line?

You need to set the property to:
[Event Procedure]
Then click the Build button (...) beside this.

Then put the line of code in between the "Private Sub..." and "End Sub"
lines.
 
Thanks so much i used the original formula from Duan and i put it into the
visual basics and there was private sub and end sub twice so i put it between
both is that right (it worked!)

Allen Browne said:
Where are you putting this line?

You need to set the property to:
[Event Procedure]
Then click the Build button (...) beside this.

Then put the line of code in between the "Private Sub..." and "End Sub"
lines.

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

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

Database User said:
it just says to me access cant find macro Cancel=(Nz(Me.
 
Excellent. You have it working.

You should end up with:
Private Sub xxx
YourCodeInHere
End Sub

You should NOT see:
Private Sub xxx
Private Sub xxx
YourCodeInHere
End Sub
End Sub

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

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

Database User said:
Thanks so much i used the original formula from Duan and i put it into the
visual basics and there was private sub and end sub twice so i put it
between
both is that right (it worked!)

Allen Browne said:
Where are you putting this line?

You need to set the property to:
[Event Procedure]
Then click the Build button (...) beside this.

Then put the line of code in between the "Private Sub..." and "End Sub"
lines.
 
Back
Top