Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1. Guest ji, please consider donating today!
      Become a Supporter    ::   Make a Contribution   
    Monthly Recurring Target: $300 :: Achieved: $95

cancel report if subreport has no data

Discussion in 'Information Technology' started by hughess7, Oct 28, 2005.

  1. hughess7

    hughess7
    Expand Collapse
    Guest

    I can not use the no data event on my main report to cancel opening as it
    always has some data. If my subreport has no data though I would like the
    main report to cancel opening.

    Tried the following but I get error 2455, Invalid reference to the property
    form/report

    If Me![Expenses Weekly].Report.HasData = False Then
    Cancel = True
    Msg = "No Expenses for " & Forms![frm resource menu]![txtSpecialist] & _
    " w/e " & Forms![frm resource menu]![StartDate] + 4
    MsgBox Msg, vbInformation
    End If

    Can anyone help with this please?

    Thanks
    Sue
     
  2. Loading...


  3. Ofer

    Ofer
    Expand Collapse
    Guest

    Use the code on the OnActivate event of the main report

    If Me![Expenses Weekly].Report.HasData = False Then
    Msg = "No Expenses for " & Forms![frm resource menu]![txtSpecialist] & _
    " w/e " & Forms![frm resource menu]![StartDate] + 4
    MsgBox Msg, vbInformation
    DoCmd.Close acReport, "Report Name"
    End If

    --
    If I answered your question, please mark it as an answer. That way, it will
    stay saved for a longer time, so other can benifit from it.

    Good luck



    "hughess7" wrote:

    > I can not use the no data event on my main report to cancel opening as it
    > always has some data. If my subreport has no data though I would like the
    > main report to cancel opening.
    >
    > Tried the following but I get error 2455, Invalid reference to the property
    > form/report
    >
    > If Me![Expenses Weekly].Report.HasData = False Then
    > Cancel = True
    > Msg = "No Expenses for " & Forms![frm resource menu]![txtSpecialist] & _
    > " w/e " & Forms![frm resource menu]![StartDate] + 4
    > MsgBox Msg, vbInformation
    > End If
    >
    > Can anyone help with this please?
    >
    > Thanks
    > Sue
     
  4. hughess7

    hughess7
    Expand Collapse
    Guest

    Thanks that sorted it!

    Sue


    "Ofer" wrote:

    > Use the code on the OnActivate event of the main report
    >
    > If Me![Expenses Weekly].Report.HasData = False Then
    > Msg = "No Expenses for " & Forms![frm resource menu]![txtSpecialist] & _
    > " w/e " & Forms![frm resource menu]![StartDate] + 4
    > MsgBox Msg, vbInformation
    > DoCmd.Close acReport, "Report Name"
    > End If
    >
    > --
    > If I answered your question, please mark it as an answer. That way, it will
    > stay saved for a longer time, so other can benifit from it.
    >
    > Good luck
    >
    >
    >
    > "hughess7" wrote:
    >
    > > I can not use the no data event on my main report to cancel opening as it
    > > always has some data. If my subreport has no data though I would like the
    > > main report to cancel opening.
    > >
    > > Tried the following but I get error 2455, Invalid reference to the property
    > > form/report
    > >
    > > If Me![Expenses Weekly].Report.HasData = False Then
    > > Cancel = True
    > > Msg = "No Expenses for " & Forms![frm resource menu]![txtSpecialist] & _
    > > " w/e " & Forms![frm resource menu]![StartDate] + 4
    > > MsgBox Msg, vbInformation
    > > End If
    > >
    > > Can anyone help with this please?
    > >
    > > Thanks
    > > Sue
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page