no records

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hi there

I want to display a messeage when the report does not have
any entries. How can i do that. I would appreciate if
somebody can help me.

Following is the sql code

SELECT PROGRAM.P_Name, OPPORTUNITY.O_Name,
INITIATIVE.I_Name, [CONTROL Support].*, [CONTROL
Support].CM_Value_Type, [CONTROL Support].CALC_Locator,
[CONTROL Support].CALC_Formula, [CONTROL Support].OU_Name,
[CONTROL Support].LOB_Name
FROM PROGRAM INNER JOIN (OPPORTUNITY INNER JOIN
(INITIATIVE INNER JOIN ([CONTROL Support] INNER JOIN
[CALCULATED METRIC] ON [CONTROL Support].CM_Name =
[CALCULATED METRIC].CM_Name) ON INITIATIVE.I_Name =
[CALCULATED METRIC].I_Name) ON OPPORTUNITY.O_Name =
INITIATIVE.O_Name) ON PROGRAM.P_Name = OPPORTUNITY.P_Name
WHERE ((([CONTROL Support].CM_Value_Type)=0)) OR
((([CONTROL Support].CALC_Locator)=0)) OR ((([CONTROL
Support].CALC_Formula)=0)) OR ((([CONTROL Support].OU_Name)
=0)) OR ((([CONTROL Support].LOB_Name)=0));


Thank you.
Tom
 
Hi there

I want to display a messeage when the report does not have
any entries. How can i do that. I would appreciate if
somebody can help me.

Following is the sql code

SELECT PROGRAM.P_Name, OPPORTUNITY.O_Name,
INITIATIVE.I_Name, [CONTROL Support].*, [CONTROL
Support].CM_Value_Type, [CONTROL Support].CALC_Locator,
[CONTROL Support].CALC_Formula, [CONTROL Support].OU_Name,
[CONTROL Support].LOB_Name
FROM PROGRAM INNER JOIN (OPPORTUNITY INNER JOIN
(INITIATIVE INNER JOIN ([CONTROL Support] INNER JOIN
[CALCULATED METRIC] ON [CONTROL Support].CM_Name =
[CALCULATED METRIC].CM_Name) ON INITIATIVE.I_Name =
[CALCULATED METRIC].I_Name) ON OPPORTUNITY.O_Name =
INITIATIVE.O_Name) ON PROGRAM.P_Name = OPPORTUNITY.P_Name
WHERE ((([CONTROL Support].CM_Value_Type)=0)) OR
((([CONTROL Support].CALC_Locator)=0)) OR ((([CONTROL
Support].CALC_Formula)=0)) OR ((([CONTROL Support].OU_Name)
=0)) OR ((([CONTROL Support].LOB_Name)=0));

Thank you.
Tom

Code the report's OnNoData event:
MsgBox "There are no records to report on."
Cancel = True

If the report has been opened by code from a command button on a for,
this will generate Error 2501.
Trap the error in the command button click event:

On Error GoTo Err_Handler
DoCmd.OpenReport "ReportName'" etc.
Exit_This_Sub:
Exit Sub
Err_Handler:
If Err = 2501 Then
Else
MsgBox "Error: " & Err.Number & " " & Err.Description
End If
Resume Exit_This_Sub
 
Back
Top