Limit results on report

G

Gavelle

I have a query set up to show the total count of each item for each person on
my list. In my report i'd like to only show the first 5 count results for
each person listed. Currently it's set up to group by person, then show the
detail (count of item, item description) Do you have any suggestions?

The top 5 query didn't work because it only showed me the top 5 results of
the entire query, not for each person.

Thank you,
 
D

Duane Hookom

You can add a text box to the detail section of the report:
Name: txtCount
Control Source: =1
Running Sum: Over Group
Visible: No

Then add some code to the On Format event of the detail section:
Cancel = Me.txtCount>5
 
G

Gavelle

Wow, that worked perfectly! I knew there would be a way to make this work
but didn't have a clue as to where i would start. Again, thank you!!!
 
T

Todd

Hi,
I must be dumb. I have tried this several times and cannot get it to work.
I have created the txt box no problem. I cannot get the results to limit to
5. I have pasted the "Cancel = Me.txtCount>5" into the "On Format" property
field. I have created a code.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = Me.TxtCount > 5
End Sub

Ive tried () [] and I cannot get this to work. Please help.

Todd
 
D

Duane Hookom

If you set the txtCount text box to visible: Yes, does it increment?
Have you compiled your code?

--
Duane Hookom
Microsoft Access MVP


Todd said:
Hi,
I must be dumb. I have tried this several times and cannot get it to work.
I have created the txt box no problem. I cannot get the results to limit to
5. I have pasted the "Cancel = Me.txtCount>5" into the "On Format" property
field. I have created a code.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = Me.TxtCount > 5
End Sub

Ive tried () [] and I cannot get this to work. Please help.

Todd
Duane Hookom said:
You can add a text box to the detail section of the report:
Name: txtCount
Control Source: =1
Running Sum: Over Group
Visible: No

Then add some code to the On Format event of the detail section:
Cancel = Me.txtCount>5
 
T

Todd

It does show the increment per user. I had not complied the code. Is it as
simple as clicking "Debug" and complie? I tried that and it does not work.

Todd

Duane Hookom said:
If you set the txtCount text box to visible: Yes, does it increment?
Have you compiled your code?

--
Duane Hookom
Microsoft Access MVP


Todd said:
Hi,
I must be dumb. I have tried this several times and cannot get it to work.
I have created the txt box no problem. I cannot get the results to limit to
5. I have pasted the "Cancel = Me.txtCount>5" into the "On Format" property
field. I have created a code.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = Me.TxtCount > 5
End Sub

Ive tried () [] and I cannot get this to work. Please help.

Todd
Duane Hookom said:
You can add a text box to the detail section of the report:
Name: txtCount
Control Source: =1
Running Sum: Over Group
Visible: No

Then add some code to the On Format event of the detail section:
Cancel = Me.txtCount>5

--
Duane Hookom
Microsoft Access MVP


:

I have a query set up to show the total count of each item for each person on
my list. In my report i'd like to only show the first 5 count results for
each person listed. Currently it's set up to group by person, then show the
detail (count of item, item description) Do you have any suggestions?

The top 5 query didn't work because it only showed me the top 5 results of
the entire query, not for each person.

Thank you,
 
D

Duane Hookom

What do you mean by "it does not work"? Didn't it compile? If it didn't you
should get an error message that you should share with us.

--
Duane Hookom
Microsoft Access MVP


Todd said:
It does show the increment per user. I had not complied the code. Is it as
simple as clicking "Debug" and complie? I tried that and it does not work.

Todd

Duane Hookom said:
If you set the txtCount text box to visible: Yes, does it increment?
Have you compiled your code?

--
Duane Hookom
Microsoft Access MVP


Todd said:
Hi,
I must be dumb. I have tried this several times and cannot get it to work.
I have created the txt box no problem. I cannot get the results to limit to
5. I have pasted the "Cancel = Me.txtCount>5" into the "On Format" property
field. I have created a code.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = Me.TxtCount > 5
End Sub

Ive tried () [] and I cannot get this to work. Please help.

Todd
:

You can add a text box to the detail section of the report:
Name: txtCount
Control Source: =1
Running Sum: Over Group
Visible: No

Then add some code to the On Format event of the detail section:
Cancel = Me.txtCount>5

--
Duane Hookom
Microsoft Access MVP


:

I have a query set up to show the total count of each item for each person on
my list. In my report i'd like to only show the first 5 count results for
each person listed. Currently it's set up to group by person, then show the
detail (count of item, item description) Do you have any suggestions?

The top 5 query didn't work because it only showed me the top 5 results of
the entire query, not for each person.

Thank you,
 
T

Todd

Sorry, I knew I should clarify that. It did compile, no errors. I am
running Access 2007 if that makes a difference. I even rebuilt the report a
couple of times just in case.

I have a text box "txtCount" it is counting up for each user. It just seems
like the "Cancel" Command does not do anything.

Option Compare Database

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = Me.TxtCount > 5
End Sub


Duane Hookom said:
What do you mean by "it does not work"? Didn't it compile? If it didn't you
should get an error message that you should share with us.

--
Duane Hookom
Microsoft Access MVP


Todd said:
It does show the increment per user. I had not complied the code. Is it as
simple as clicking "Debug" and complie? I tried that and it does not work.

Todd

Duane Hookom said:
If you set the txtCount text box to visible: Yes, does it increment?
Have you compiled your code?

--
Duane Hookom
Microsoft Access MVP


:

Hi,
I must be dumb. I have tried this several times and cannot get it to work.
I have created the txt box no problem. I cannot get the results to limit to
5. I have pasted the "Cancel = Me.txtCount>5" into the "On Format" property
field. I have created a code.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = Me.TxtCount > 5
End Sub

Ive tried () [] and I cannot get this to work. Please help.

Todd
:

You can add a text box to the detail section of the report:
Name: txtCount
Control Source: =1
Running Sum: Over Group
Visible: No

Then add some code to the On Format event of the detail section:
Cancel = Me.txtCount>5

--
Duane Hookom
Microsoft Access MVP


:

I have a query set up to show the total count of each item for each person on
my list. In my report i'd like to only show the first 5 count results for
each person listed. Currently it's set up to group by person, then show the
detail (count of item, item description) Do you have any suggestions?

The top 5 query didn't work because it only showed me the top 5 results of
the entire query, not for each person.

Thank you,
 
D

Duane Hookom

Are you selecting Print Preview?
--
Duane Hookom
Microsoft Access MVP


Todd said:
Sorry, I knew I should clarify that. It did compile, no errors. I am
running Access 2007 if that makes a difference. I even rebuilt the report a
couple of times just in case.

I have a text box "txtCount" it is counting up for each user. It just seems
like the "Cancel" Command does not do anything.

Option Compare Database

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = Me.TxtCount > 5
End Sub


Duane Hookom said:
What do you mean by "it does not work"? Didn't it compile? If it didn't you
should get an error message that you should share with us.

--
Duane Hookom
Microsoft Access MVP


Todd said:
It does show the increment per user. I had not complied the code. Is it as
simple as clicking "Debug" and complie? I tried that and it does not work.

Todd

:

If you set the txtCount text box to visible: Yes, does it increment?
Have you compiled your code?

--
Duane Hookom
Microsoft Access MVP


:

Hi,
I must be dumb. I have tried this several times and cannot get it to work.
I have created the txt box no problem. I cannot get the results to limit to
5. I have pasted the "Cancel = Me.txtCount>5" into the "On Format" property
field. I have created a code.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = Me.TxtCount > 5
End Sub

Ive tried () [] and I cannot get this to work. Please help.

Todd
:

You can add a text box to the detail section of the report:
Name: txtCount
Control Source: =1
Running Sum: Over Group
Visible: No

Then add some code to the On Format event of the detail section:
Cancel = Me.txtCount>5

--
Duane Hookom
Microsoft Access MVP


:

I have a query set up to show the total count of each item for each person on
my list. In my report i'd like to only show the first 5 count results for
each person listed. Currently it's set up to group by person, then show the
detail (count of item, item description) Do you have any suggestions?

The top 5 query didn't work because it only showed me the top 5 results of
the entire query, not for each person.

Thank you,
 
T

Todd

For crying out loud. You think you would have to tell me how to turn a
computer on!!

It works. I was using Report View. Thank you for your help and patience.

Todd

Duane Hookom said:
Are you selecting Print Preview?
--
Duane Hookom
Microsoft Access MVP


Todd said:
Sorry, I knew I should clarify that. It did compile, no errors. I am
running Access 2007 if that makes a difference. I even rebuilt the report a
couple of times just in case.

I have a text box "txtCount" it is counting up for each user. It just seems
like the "Cancel" Command does not do anything.

Option Compare Database

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = Me.TxtCount > 5
End Sub


Duane Hookom said:
What do you mean by "it does not work"? Didn't it compile? If it didn't you
should get an error message that you should share with us.

--
Duane Hookom
Microsoft Access MVP


:

It does show the increment per user. I had not complied the code. Is it as
simple as clicking "Debug" and complie? I tried that and it does not work.

Todd

:

If you set the txtCount text box to visible: Yes, does it increment?
Have you compiled your code?

--
Duane Hookom
Microsoft Access MVP


:

Hi,
I must be dumb. I have tried this several times and cannot get it to work.
I have created the txt box no problem. I cannot get the results to limit to
5. I have pasted the "Cancel = Me.txtCount>5" into the "On Format" property
field. I have created a code.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = Me.TxtCount > 5
End Sub

Ive tried () [] and I cannot get this to work. Please help.

Todd
:

You can add a text box to the detail section of the report:
Name: txtCount
Control Source: =1
Running Sum: Over Group
Visible: No

Then add some code to the On Format event of the detail section:
Cancel = Me.txtCount>5

--
Duane Hookom
Microsoft Access MVP


:

I have a query set up to show the total count of each item for each person on
my list. In my report i'd like to only show the first 5 count results for
each person listed. Currently it's set up to group by person, then show the
detail (count of item, item description) Do you have any suggestions?

The top 5 query didn't work because it only showed me the top 5 results of
the entire query, not for each person.

Thank you,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top