Welcome to SPN

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

Sign Up Now!

Msgbox to display no filtered results

Discussion in 'Information Technology' started by Scott, Jul 28, 2006.

  1. Scott

    Scott
    Expand Collapse
    Guest

    I have a form set up to search my table and it opens another form or report
    (based on a checkbox) with the filtered results. The filter is a combination
    of a query and a where condition on DoCmd.OpenForm/DoCmd.OpenReport. If the
    search terms are too specific and there are no records that match, I want a
    message box to pop up and inform the user instead of just opening a blank
    form or report. I can't figure out how to do it. Please help!!
     
  2. Loading...

    Similar Threads Forum Date
    Heritage Sikh Artwork On Display At Texas University History of Sikhism Mar 6, 2015
    UK Sikh Turbans on display at Bradford exhibition Breaking News Mar 1, 2014
    History Rare photographs’ display: Sikh community and culture presented in vibrant colour Punjab, Punjabi, Punjabiyat Dec 8, 2013
    Events Manuscripts on display at National Museum of Pakistan. History of Sikhism Mar 3, 2013
    Turban Display Uncovers Sikh History Sikh Youth Jun 7, 2011

  3. deluxeinformation@gmail.com

    deluxeinformation@gmail.com
    Expand Collapse
    Guest

    Scott wrote:
    > I have a form set up to search my table and it opens another form or report
    > (based on a checkbox) with the filtered results. The filter is a combination
    > of a query and a where condition on DoCmd.OpenForm/DoCmd.OpenReport. If the
    > search terms are too specific and there are no records that match, I want a
    > message box to pop up and inform the user instead of just opening a blank
    > form or report. I can't figure out how to do it. Please help!!


    Set the Visible property of your form or report to False. Then in the
    load event of your form put the following:

    If Me.RecordSetClone.RecordCount = 0 Then
    MsgBox "No records found."
    DoCmd.Close
    Else
    Me.Visible = True
    End If

    If this is a report, you can simply put the the following in the NoData
    event of the report:

    MsgBox "No records found."
    Cancel = True

    Hope this helps.

    Bruce
     
  4. deluxeinformation@gmail.com

    deluxeinformation@gmail.com
    Expand Collapse
    Guest

    deluxeinformation@gmail.com wrote:
    > Scott wrote:
    > > I have a form set up to search my table and it opens another form or report
    > > (based on a checkbox) with the filtered results. The filter is a combination
    > > of a query and a where condition on DoCmd.OpenForm/DoCmd.OpenReport. If the
    > > search terms are too specific and there are no records that match, I want a
    > > message box to pop up and inform the user instead of just opening a blank
    > > form or report. I can't figure out how to do it. Please help!!

    >
    > Set the Visible property of your form or report to False. Then in the
    > load event of your form put the following:


    Sorry...this should read "If using a form to display the results, set
    the Visible property of the form to False. Then in the load event of
    your form put the following:"

    Bruce
     
  5. Scott

    Scott
    Expand Collapse
    Guest

    Thanks Bruce! It works perfectly!

    "deluxeinformation@gmail.com" wrote:

    >
    > deluxeinformation@gmail.com wrote:
    > > Scott wrote:
    > > > I have a form set up to search my table and it opens another form or report
    > > > (based on a checkbox) with the filtered results. The filter is a combination
    > > > of a query and a where condition on DoCmd.OpenForm/DoCmd.OpenReport. If the
    > > > search terms are too specific and there are no records that match, I want a
    > > > message box to pop up and inform the user instead of just opening a blank
    > > > form or report. I can't figure out how to do it. Please help!!

    > >
    > > Set the Visible property of your form or report to False. Then in the
    > > load event of your form put the following:

    >
    > Sorry...this should read "If using a form to display the results, set
    > the Visible property of the form to False. Then in the load event of
    > your form put the following:"
    >
    > Bruce
    >
    >
     

Share This Page