Determine if a corosponding record exist for a master record on a subreport

  • Thread starter Thread starter Jasonm
  • Start date Start date
J

Jasonm

I need to determine if a record exists on a subreport for any given master
record on the main report and if it does what its value is... I have been
trying to putz around with this for a while, but am not seeming to get it...

There may or may not be a record in the sub report for every master record
on the main report. and there will only be ONE record (if any) in the
subreport for every master on the main report.

Is there a sample of code floating around out there that I can look at to
modify for my own purposes?

Any assistance would be greatly appreciated. I know basic VBA and VB so I am
trying to keep it fairly simple.

Thanks, Jason M
 
To see if there is any record in Sub1, use:
=IIf[Sub1].[Report].[HasData], "Yes, stuff there", "Nuffing found")

If you need to suppress the main report records that have no match for the
subform, you could just include the subreport's table in the query that
feeds the main report. The inner join would cause no master record to appear
unless it has a related record. (You say there can only be one related
record, so this will not cause a record to appear multiple times in the main
report.)
 
Allen,

Thank you very much, I will give this a shot. I do not want to suppress the
main record that is why I have been struggling with this for so long!

I am going to put this in the report On Open event... Is that appropriate?

Thanks again,

JasonM
Allen Browne said:
To see if there is any record in Sub1, use:
=IIf[Sub1].[Report].[HasData], "Yes, stuff there", "Nuffing found")

If you need to suppress the main report records that have no match for the
subform, you could just include the subreport's table in the query that
feeds the main report. The inner join would cause no master record to
appear unless it has a related record. (You say there can only be one
related record, so this will not cause a record to appear multiple times
in the main report.)

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

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

Jasonm said:
I need to determine if a record exists on a subreport for any given master
record on the main report and if it does what its value is... I have been
trying to putz around with this for a while, but am not seeming to get
it...

There may or may not be a record in the sub report for every master
record on the main report. and there will only be ONE record (if any) in
the subreport for every master on the main report.

Is there a sample of code floating around out there that I can look at to
modify for my own purposes?

Any assistance would be greatly appreciated. I know basic VBA and VB so I
am trying to keep it fairly simple.

Thanks, Jason M
 
OOP's! It looks like this needs to go in the control source of a txt
control... I will try that instead of the above...
Jasonm said:
Allen,

Thank you very much, I will give this a shot. I do not want to suppress
the main record that is why I have been struggling with this for so long!

I am going to put this in the report On Open event... Is that appropriate?

Thanks again,

JasonM
Allen Browne said:
To see if there is any record in Sub1, use:
=IIf[Sub1].[Report].[HasData], "Yes, stuff there", "Nuffing found")

If you need to suppress the main report records that have no match for
the subform, you could just include the subreport's table in the query
that feeds the main report. The inner join would cause no master record
to appear unless it has a related record. (You say there can only be one
related record, so this will not cause a record to appear multiple times
in the main report.)

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

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

Jasonm said:
I need to determine if a record exists on a subreport for any given
master record on the main report and if it does what its value is... I
have been trying to putz around with this for a while, but am not seeming
to get it...

There may or may not be a record in the sub report for every master
record on the main report. and there will only be ONE record (if any) in
the subreport for every master on the main report.

Is there a sample of code floating around out there that I can look at
to modify for my own purposes?

Any assistance would be greatly appreciated. I know basic VBA and VB so
I am trying to keep it fairly simple.

Thanks, Jason M
 
Report_Open is too early.
Use the Format event of the section that contains the control.

Or just put the expression into the Control Source of a text box if that
will do.

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

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

Jasonm said:
Allen,

Thank you very much, I will give this a shot. I do not want to suppress
the main record that is why I have been struggling with this for so long!

I am going to put this in the report On Open event... Is that appropriate?

Thanks again,

JasonM
Allen Browne said:
To see if there is any record in Sub1, use:
=IIf[Sub1].[Report].[HasData], "Yes, stuff there", "Nuffing found")

If you need to suppress the main report records that have no match for
the subform, you could just include the subreport's table in the query
that feeds the main report. The inner join would cause no master record
to appear unless it has a related record. (You say there can only be one
related record, so this will not cause a record to appear multiple times
in the main report.)


Jasonm said:
I need to determine if a record exists on a subreport for any given
master record on the main report and if it does what its value is... I
have been trying to putz around with this for a while, but am not seeming
to get it...

There may or may not be a record in the sub report for every master
record on the main report. and there will only be ONE record (if any) in
the subreport for every master on the main report.

Is there a sample of code floating around out there that I can look at
to modify for my own purposes?

Any assistance would be greatly appreciated. I know basic VBA and VB so
I am trying to keep it fairly simple.
 
Allen, again thank you very much for the point in the right direction! I did
use what you gave me as the control source and have had gread success in
manipulating it to do exactly what I was needing!

Thank you!

Jasonm

Allen Browne said:
Report_Open is too early.
Use the Format event of the section that contains the control.

Or just put the expression into the Control Source of a text box if that
will do.

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

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

Jasonm said:
Allen,

Thank you very much, I will give this a shot. I do not want to suppress
the main record that is why I have been struggling with this for so long!

I am going to put this in the report On Open event... Is that
appropriate?

Thanks again,

JasonM
Allen Browne said:
To see if there is any record in Sub1, use:
=IIf[Sub1].[Report].[HasData], "Yes, stuff there", "Nuffing found")

If you need to suppress the main report records that have no match for
the subform, you could just include the subreport's table in the query
that feeds the main report. The inner join would cause no master record
to appear unless it has a related record. (You say there can only be one
related record, so this will not cause a record to appear multiple times
in the main report.)


I need to determine if a record exists on a subreport for any given
master record on the main report and if it does what its value is... I
have been trying to putz around with this for a while, but am not
seeming to get it...

There may or may not be a record in the sub report for every master
record on the main report. and there will only be ONE record (if any)
in the subreport for every master on the main report.

Is there a sample of code floating around out there that I can look at
to modify for my own purposes?

Any assistance would be greatly appreciated. I know basic VBA and VB so
I am trying to keep it fairly simple.
 
Back
Top