Sum problem

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

I have a report that adds up my total, but if the total
is 0 i get a error here is my code any help would be
great
=Sum([Number Of Canoes])
 
That shouldn't happen. There's something you aren't telling us.

Is it that the total numbers in the field add up to 0 or is it that there
are no records in the report.

Is 'Number Of Canoes' a Number field in Table Design?

Do you have this text box in a group or report footer? Or are you talking
about a field in a query?

Evi
 
HI:

I think you mean NULL , not 0

In your query under the [Number Of Canoes] field add the following criteria

not like null

this will exclude records where there are no [Number of Canoes] entries
 
Sorry when it comes back with no records then i get the
#Error,

'Number Of Canoes' is a number field in the table,

Everything works fine if it gets a record in the Report,
The Report runs off of a querie
-----Original Message-----
That shouldn't happen. There's something you aren't telling us.

Is it that the total numbers in the field add up to 0 or is it that there
are no records in the report.

Is 'Number Of Canoes' a Number field in Table Design?

Do you have this text box in a group or report footer? Or are you talking
about a field in a query?

Evi




Sean said:
I have a report that adds up my total, but if the total
is 0 i get a error here is my code any help would be
great
=Sum([Number Of Canoes])


.
 
So what you really mean is that there are no records in the report.

A way around this is to use the report's OnNoData Event.

In design view, click the Property button on the toolbar. Click on the text
box that has the sum so that you know it's name. (in the Other tab of the
Properties window)

Click in the grey area just below the white grid of the report and the
Property button should now say Report at the top.

Click on the Events tab.

Click on the OnNoData row. Choose Event Procedure.

Click just left of that and a code page will open

Type in between the rows of code so that you end up with something like
this.


Private Sub Report_NoData(Cancel As Integer)
Me.Text9.Visible = False
End Sub

(You would type the name of your text box rather than Text9)

Does this do what you want?

Evi


Sean said:
Sorry when it comes back with no records then i get the
#Error,

'Number Of Canoes' is a number field in the table,

Everything works fine if it gets a record in the Report,
The Report runs off of a querie
-----Original Message-----
That shouldn't happen. There's something you aren't telling us.

Is it that the total numbers in the field add up to 0 or is it that there
are no records in the report.

Is 'Number Of Canoes' a Number field in Table Design?

Do you have this text box in a group or report footer? Or are you talking
about a field in a query?

Evi




Sean said:
I have a report that adds up my total, but if the total
is 0 i get a error here is my code any help would be
great
=Sum([Number Of Canoes])


.
 
Back
Top