Connecting Tech Pros Worldwide Help | Site Map

Help With Sub-Forms

cappelquist@gmail.com
Guest
 
Posts: n/a
#1: Feb 8 '06
I have a small Task List / Project Management / Time Management app I'm
building for my own use. Any "Getting Things Done" (GTD) users out
there?

I want a main form that has a large List Box on the right side of the
main form that will list Projects by name. In the top right section of
the main form, I want a sub-form that will be a Datasheet format that
will list Tasks for a given Project.

So, I want to be able to Highlight a Project in the Right side Projects
List Box and have the Tasks associated to THAT Project appear in the
Top right "prjTasks" sub-form.

I've done some work with Subforms, but I need help with making it work
by clicking on the List Box entry.

Second level - In the Bottom right, I want to show specifics about a
given TASK, so that if I select the project "Make a Sandwich" and then
select the 3rd task in the task list for making a sandwich - "Put Mayo
on Bread" , I would see specifics, like Due Date for the task,
Priority, Person assigned the task, and a large text box for a detailed
task description.

I have a Table called tblProjects with key field prjID, and a table
called tblProjectTasks with a key field tskID and a field : prjID being
the foreign key to the key field in tblProjects.

I think I can handle most of it, if I get a little help with populating
the top right sub-form when a given entry in the list box has focus.

salad
Guest
 
Posts: n/a
#2: Feb 8 '06

re: Help With Sub-Forms


cappelquist@gmail.com wrote:[color=blue]
> I have a small Task List / Project Management / Time Management app I'm
> building for my own use. Any "Getting Things Done" (GTD) users out
> there?
>
> I want a main form that has a large List Box on the right side of the
> main form that will list Projects by name. In the top right section of
> the main form, I want a sub-form that will be a Datasheet format that
> will list Tasks for a given Project.
>
> So, I want to be able to Highlight a Project in the Right side Projects
> List Box and have the Tasks associated to THAT Project appear in the
> Top right "prjTasks" sub-form.
>
> I've done some work with Subforms, but I need help with making it work
> by clicking on the List Box entry.
>
> Second level - In the Bottom right, I want to show specifics about a
> given TASK, so that if I select the project "Make a Sandwich" and then
> select the 3rd task in the task list for making a sandwich - "Put Mayo
> on Bread" , I would see specifics, like Due Date for the task,
> Priority, Person assigned the task, and a large text box for a detailed
> task description.
>
> I have a Table called tblProjects with key field prjID, and a table
> called tblProjectTasks with a key field tskID and a field : prjID being
> the foreign key to the key field in tblProjects.
>
> I think I can handle most of it, if I get a little help with populating
> the top right sub-form when a given entry in the list box has focus.
>[/color]
In the listbox, is the first column hidden and the projectID? If so,
you could do something like this
Forms!MainForm!Subform.Form.Filter = _
"ProjectID = " & Me.ListBox0
Forms!MainForm!Subform.Form.FilterOn = True
and put this on the onclick event of the listbox. Change the formnames
and listbox to match yours.
Larry Linson
Guest
 
Posts: n/a
#3: Feb 8 '06

re: Help With Sub-Forms


<cappelquist@gmail.com> wrote
[color=blue]
> I want a main form that has a large List Box
> on the right side of the main form that will list
> Projects by name. In the top right section of
> the main form, I want a sub-form that will be
> a Datasheet format that will list Tasks for a
> given Project.[/color]

To each his own, they say, but most people are accustomed to seeing the
summary / overall view at the top, then the detail view below that.
Secondly, I can't recommend strongly enough that you use a Continuous Forms
View Form in your Subform (though, if you feel compelled to do so, you can
show it in Datasheet view). Datasheet view is for end-user use of the DB,
and gives inexperienced users too many opportunities to do something
"unexpected" in a developed application. Forms provide events that you can
use to control the application.
[color=blue]
> So, I want to be able to Highlight a Project in
> the Right side Projects List Box and have the
> Tasks associated to THAT Project appear in the
> Top right "prjTasks" sub-form.
>
> I've done some work with Subforms, but I need
> help with making it work by clicking on the List
> Box entry.[/color]

Be sure, as Salad has suggested, to include the prjID Field as the bound
column in your listbox, though you can size the column so it is not visible,
if you wish. However, instead of his approach of creating a filter, you can
simply use the name of the List Box (provided it can be distinguished from
the Field... I'd call it lstProject) as the LinkMasterFields and the
corresponding foreign key Field in tblProjectTasks as the LinkChildFields.
Selection of the appropriate Tasks will then be automatic when you choose a
project from the List Box... you will not need to create the criteria clause
and filter that form.
[color=blue]
> Second level - In the Bottom right, I want to show
> specifics about a given TASK, so that if I select
> the project "Make a Sandwich" and then select
> the 3rd task in the task list for making a sandwich -
> "Put Mayo on Bread" , I would see specifics, like
> Due Date for the task, Priority, Person assigned
> the task, and a large text box for a detailed
> task description.[/color]

It is not clear whether you intend this to be on the main Form or in another
Subform Control. Even if it is at the same level as the Subform from which
you chose the Task, you can, with proper "qualification" refer to the Task
ID in that subform as the LinkMasterFields.
[color=blue]
> I have a Table called tblProjects with key field
> prjID, and a table called tblProjectTasks with
> a key field tskID and a field : prjID being
> the foreign key to the key field in tblProjects.
>
> I think I can handle most of it, if I get a little
> help with populating the top right sub-form
> when a given entry in the list box has focus.[/color]

All that said, you may be able to accomplish your purpose in an easier
manner by using two List or Combo Boxes and the approach described in
http://www.mvps.org/access/forms/frm0028.htm, an article entitled "Forms:
Limit content of combo/list boxes".

Larry Linson
Microsoft Access MVP



cappelquist@gmail.com
Guest
 
Posts: n/a
#4: Feb 8 '06

re: Help With Sub-Forms


Thanks for your help so far.
Here's what I've got at this point:
I have a main form that is bound to the tblProjects and has a list box
running the length of the right side of my form and it has prjID and
prjName (prjID is hidden in the drop down list.

I created a form sfrmPrjTasks, which at this point is a Datasheet view
(I will think about changing to a continuous forms layout) and it works
OK so far. If I click on a Project in the List box, all of the Tasks
for that Project appear in my Subform on the right side.

Now what I need to do:
I want to create another Subform, sfrmTaskDetails. But I want that to
be a sub-Form to the first Sub-form sfrmPrjTasks so that when I select
a row in the sfrmPrjTasks, it displays that specific record from the
tblPrjTasks and shows all of the detail fields.

I suspect that cannot be done directly (A sub-form that is not bound to
the main form but rather to another sub-form)

So, I tried modifying the sfrmPrjTasks, and embedding the new subform
into it, and then placing THAT on th emain form. No Joy.
I only see the Datasheet rows. And there is the problem. I'm betting
even as I type this, that if I change the subform to a continuous form
and put the subform sfrmTaskDetails in the Form footer , I might just
get lucky.

Unless of course that am completely nuts and there is a better way (to
quote the democratic governor of Virgina )

Thoughts?

Closed Thread


Similar Microsoft Access / VBA bytes