Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2004
    Posts
    44

    Unanswered: Problem with Report

    The way I currently have things set up is that I am
    running 3 forms within a form. On each subform I have a
    combo box, where upon selection of a criteria, the rest
    of the subform is populated. What I would like to happen
    is that after choices on the subform(s) are selected, I
    want to print out a report of the results.
    Is this doable, or do I need to find another way to
    achive my goal?

    Thanks in advance.

  2. #2
    Join Date
    Aug 2003
    Posts
    106

    Report from Form

    Create your report in design view. Set the control sources of textboxes and controls to link directly from the form.subform

    Have a button on your subform saying 'Create Report'. In the Click Event property, use the command

    DoCmd.OpenReport ....

    Alternatively you could use the code on a key press or on the drop down of a combo etc.

    sugarflux

  3. #3
    Join Date
    Jan 2004
    Posts
    44
    Thanks for the reply. I'll give it a try.

    However, after giving it some thought - would I be off base taking my 3 tables that I currently have and combining them into one? Because as it stands I have each subform only accessing one table and only one row at a time. This means I have limited myself to the number of comparisons that I can make.

    What I think I need to do is have a combo box on the main form asking how many items do I want to compare. Then if I pick 5 I would have 5 subforms pop up, each with their own combo box. But with one table as the source, we would be able to compare items that are currently within a table.

    Am I off base here, or is this doable and does it sound like the correct way to approach this?

    Regards,

    David

  4. #4
    Join Date
    Aug 2003
    Posts
    106

    Might run into problems

    You are not too far off base here, except that 'having sub-forms pop up' is asking for trouble. If you are thinking of choosing an amount of subforms and then creating them, you would have to do this to the form in design mode which means the code would need to be attached to another form.

    I would steer clear of this.

    It's difficult to understand exactly what you mean but i would be more inclined to use a 'wizard' type approach. Use the Tab control and have a subform on each Tab page. Have a next or Add button on the form which would display the next page of the tab control.

    Don't take my advice unless it makes any sense - as i say it's difficult to understand exactly what you mean!!

    sugarflux

  5. #5
    Join Date
    Jan 2004
    Posts
    44
    Well what I'm working with is budgetary figures for different programs. I suppose you could look at it similar to a sports league.

    Let's just say we are working with years 1-5.

    The way I have it set up now is with three "conferences", and you pick a "team" from each "conference". After you pick your "team" the rest of the subforms if filled in with how much was spent in years 1-5, each year being it's own text box.

    However, this does not let me include "teams" from within the same "conference" and limits me to only comparing cross-conference, as well as only 3 at a time.

    What I would to do is have a drop down listing 1-18 (18 teams), and then after I pick my number that many forms/subforms(????) will pop up on the form(?) and then I can pick a "team" from a combo box.

    Then, as I said, I'd ultimately like to take my results and put them into a report. However, I'm not sure this is doable using forms and subforms.

  6. #6
    Join Date
    Aug 2003
    Posts
    106

    SQL

    You can populate your subforms according to a Combo box using the RecordSource of the forms and SQL statements.

    Something along the lines of:

    Combo Box - select 'Team1'

    Form1!Subform1.RecordSource = "SELECT Table1.Year1, Table1.Year2, Table1.Year3, Table1.Year4, Table1.Year5 FROM Table1 WHERE (([Table1]![TeamName])='" & Form1.ComboBox.Value & "')"

    Form1.Subform1.Update

    This would populate Subform1 on Form1 with year1 - year5 records from Table1 only where the teamname is the value in the combo box.

    Is this any help?

    sugarflux

  7. #7
    Join Date
    Jan 2004
    Posts
    44
    It sounds like it is helpful, but I'm a novice to coding, so it may be a bit murky. However, SQL seems self-explantory to a certain extent. I'll definitely give it a shot.

    However, having not tried anything yet, how would I populate the Form with "X" subforms though? If I only want to compare 2 "teams" I'd like for there to only be 2 subforms on the form. Or, if I want 5 comparisons, 5 subforms, etc.

Posting Permissions

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