Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Posts
    122

    Unanswered: Subform based on stored procedure

    I am trying to setup a subform that is displayed only when a stored procedure yields results. I would then like for the subform to not be displayed if the stored procedure yields no results. What If / Then expression can I use? I keep getting "no value" errors for all of the expressions I try. Thanks for any help.

  2. #2
    Join Date
    Feb 2004
    Location
    Dorset UK
    Posts
    147
    If you have a subreport (call it sub1 in your main form) , you can base the criteria in that subreport (in the record source) section to the form its in.

    for example, if your main form has a listbox called name_list (values A,b,c) you could have the sub report criteria : [Forms]![Frm_Main]![Name_List].

    Then under the list box 'on events section' goto the 'afterupdate' and in that module have me.sub1.requery.

    That might do it..Failing that, tell me why not...and I'll try again

    ~Ken

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Try:


    If yourExpresion then
      Forms!mainFormName!SubFormName.Form.Re cordSource="SELECT * FROM ....."

    Else
      Forms!mainFormName!SubFormName.Form.RecordSource=" "
    EndIf

  4. #4
    Join Date
    Feb 2004
    Location
    Dorset UK
    Posts
    147

    Smile

    Thanks hammbakka

    Thats even better than my answer..

    I think thats called natural selection by Charles Darwin, it starts off small and eventually becomes more efficient and more adapted....

  5. #5
    Join Date
    Sep 2003
    Posts
    122
    I think I may have asked my question wrong. I need help with the expression. I have the form setup and ready to go. It gets its recordsource from a stored procedure.

    Currently, it is being displayed at all times. I would rather have it setup to be displayed only when a criteria is met in the underlying form. As an example, I have a subform that has notes and their respective type of note. Also, not all records have notes. What I would like to see happen, is if the record has a note with type 1, then my subform will popup. If the record does not have a note with type 1 OR does not have a note at all, then the subform does not popup.

    Thank you both for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •