date range

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

Guest

Dears,

I have a report which pulls info. on date range, but if no data processed
within these dates, it gives me a error. I need the field that shows error
i.e. a total field with either zero or a text message

thanks , any help will be appreciated
 
Test the HasData property of the report, e.g.:
=IIf([Report].[HasData], Sum([Amount]), Null)

Replace "Amount" with the name of your field.

Use 0 in place of Null if you wish, but it is better not to use Text here.
If you do, Access may think this value is text and not treat it correctly if
you do something else with it (such as comparing it to another number, or
adding it to another number.)
 
put the code under
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)

End Sub

report gives me compile error, where should I put this code
Thanks

Allen Browne said:
Test the HasData property of the report, e.g.:
=IIf([Report].[HasData], Sum([Amount]), Null)

Replace "Amount" with the name of your field.

Use 0 in place of Null if you wish, but it is better not to use Text here.
If you do, Access may think this value is text and not treat it correctly if
you do something else with it (such as comparing it to another number, or
adding it to another number.)

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

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

Gerald said:
Dears,

I have a report which pulls info. on date range, but if no data processed
within these dates, it gives me a error. I need the field that shows error
i.e. a total field with either zero or a text message

thanks , any help will be appreciated
 
No code neeed.

I assumed you have a control with its Control Source set to:
=Sum([Amount])

The idea is to put this in the Control Source instead:
=IIf([Report].[HasData], Sum([Amount]), Null)

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

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

Gerald said:
put the code under
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)

End Sub

report gives me compile error, where should I put this code
Thanks

Allen Browne said:
Test the HasData property of the report, e.g.:
=IIf([Report].[HasData], Sum([Amount]), Null)

Replace "Amount" with the name of your field.

Use 0 in place of Null if you wish, but it is better not to use Text
here.
If you do, Access may think this value is text and not treat it correctly
if
you do something else with it (such as comparing it to another number, or
adding it to another number.)

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

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

Gerald said:
Dears,

I have a report which pulls info. on date range, but if no data
processed
within these dates, it gives me a error. I need the field that shows
error
i.e. a total field with either zero or a text message

thanks , any help will be appreciated
 
yes, you are correct.

when I put under control source on print preview it gives me a error that
database can't find the macro

thanks

Allen Browne said:
No code neeed.

I assumed you have a control with its Control Source set to:
=Sum([Amount])

The idea is to put this in the Control Source instead:
=IIf([Report].[HasData], Sum([Amount]), Null)

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

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

Gerald said:
put the code under
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)

End Sub

report gives me compile error, where should I put this code
Thanks

Allen Browne said:
Test the HasData property of the report, e.g.:
=IIf([Report].[HasData], Sum([Amount]), Null)

Replace "Amount" with the name of your field.

Use 0 in place of Null if you wish, but it is better not to use Text
here.
If you do, Access may think this value is text and not treat it correctly
if
you do something else with it (such as comparing it to another number, or
adding it to another number.)

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

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

Dears,

I have a report which pulls info. on date range, but if no data
processed
within these dates, it gives me a error. I need the field that shows
error
i.e. a total field with either zero or a text message

thanks , any help will be appreciated
 
What macro is it looking for?

Setting the Control Source of a text box does not refer to a macro.

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

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

Gerald said:
yes, you are correct.

when I put under control source on print preview it gives me a error that
database can't find the macro

thanks

Allen Browne said:
No code neeed.

I assumed you have a control with its Control Source set to:
=Sum([Amount])

The idea is to put this in the Control Source instead:
=IIf([Report].[HasData], Sum([Amount]), Null)

Gerald said:
put the code under
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)

End Sub

report gives me compile error, where should I put this code
Thanks

:

Test the HasData property of the report, e.g.:
=IIf([Report].[HasData], Sum([Amount]), Null)

Replace "Amount" with the name of your field.

Use 0 in place of Null if you wish, but it is better not to use Text
here.
If you do, Access may think this value is text and not treat it
correctly
if
you do something else with it (such as comparing it to another number,
or
adding it to another number.)

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

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

Dears,

I have a report which pulls info. on date range, but if no data
processed
within these dates, it gives me a error. I need the field that shows
error
i.e. a total field with either zero or a text message
 
I will check again in another of my database and reply if any issues

thanks for your help, Allen

Allen Browne said:
What macro is it looking for?

Setting the Control Source of a text box does not refer to a macro.

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

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

Gerald said:
yes, you are correct.

when I put under control source on print preview it gives me a error that
database can't find the macro

thanks

Allen Browne said:
No code neeed.

I assumed you have a control with its Control Source set to:
=Sum([Amount])

The idea is to put this in the Control Source instead:
=IIf([Report].[HasData], Sum([Amount]), Null)

put the code under
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)

End Sub

report gives me compile error, where should I put this code
Thanks

:

Test the HasData property of the report, e.g.:
=IIf([Report].[HasData], Sum([Amount]), Null)

Replace "Amount" with the name of your field.

Use 0 in place of Null if you wish, but it is better not to use Text
here.
If you do, Access may think this value is text and not treat it
correctly
if
you do something else with it (such as comparing it to another number,
or
adding it to another number.)

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

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

Dears,

I have a report which pulls info. on date range, but if no data
processed
within these dates, it gives me a error. I need the field that shows
error
i.e. a total field with either zero or a text message
 
Thanks a bunch, it works.

for date range that appears in theheader, it shows error# as well, how to
use the HasData property in date

Thanks

Allen Browne said:
What macro is it looking for?

Setting the Control Source of a text box does not refer to a macro.

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

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

Gerald said:
yes, you are correct.

when I put under control source on print preview it gives me a error that
database can't find the macro

thanks

Allen Browne said:
No code neeed.

I assumed you have a control with its Control Source set to:
=Sum([Amount])

The idea is to put this in the Control Source instead:
=IIf([Report].[HasData], Sum([Amount]), Null)

put the code under
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)

End Sub

report gives me compile error, where should I put this code
Thanks

:

Test the HasData property of the report, e.g.:
=IIf([Report].[HasData], Sum([Amount]), Null)

Replace "Amount" with the name of your field.

Use 0 in place of Null if you wish, but it is better not to use Text
here.
If you do, Access may think this value is text and not treat it
correctly
if
you do something else with it (such as comparing it to another number,
or
adding it to another number.)

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

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

Dears,

I have a report which pulls info. on date range, but if no data
processed
within these dates, it gives me a error. I need the field that shows
error
i.e. a total field with either zero or a text message
 
Use:
=IIf([Report].[HasData], XXXX, Null)
where the XXXX represents whatever expression does work when the report has
data.

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

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

Gerald said:
Thanks a bunch, it works.

for date range that appears in theheader, it shows error# as well, how to
use the HasData property in date

Thanks

Allen Browne said:
What macro is it looking for?

Setting the Control Source of a text box does not refer to a macro.

Gerald said:
yes, you are correct.

when I put under control source on print preview it gives me a error
that
database can't find the macro

thanks

:

No code neeed.

I assumed you have a control with its Control Source set to:
=Sum([Amount])

The idea is to put this in the Control Source instead:
=IIf([Report].[HasData], Sum([Amount]), Null)

put the code under
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)

End Sub

report gives me compile error, where should I put this code
Thanks

:

Test the HasData property of the report, e.g.:
=IIf([Report].[HasData], Sum([Amount]), Null)

Replace "Amount" with the name of your field.

Use 0 in place of Null if you wish, but it is better not to use
Text
here.
If you do, Access may think this value is text and not treat it
correctly
if
you do something else with it (such as comparing it to another
number,
or
adding it to another number.)

Dears,

I have a report which pulls info. on date range, but if no data
processed
within these dates, it gives me a error. I need the field that
shows
error
i.e. a total field with either zero or a text message
 
Back
Top