pass data from subform to form

G

gregc

I have a access 2003 database for project tracking, it has 3 tables with
ProjectNum being the link for all 3.
I have subforms on a main form that display information related to the
project, the 1st subform has the Action items with an actionid,and
projectnum, the 2nd form has the tasks with an taskid, actionid and
projectnum, each task have due dates, what i want to do is take the tasks due
date maximum date value: ie 8/21/2006 for a group of tasks with different due
dates and pass that data to the the action item duedate field on the action
item subform, and then the maximum date on the action item subform for each
of the action items to the main form's duedate feild for each project using
the same maximum value. any coding suggestions would be great, i am sure
there will be questions so let me know.
Thanks
Greg
 
P

Powderfinger

Let me get this straight.

The Main form has two important fields: ProjectNum and MaxActionIDDueDate.

The first subform (ActionSubform) has three: ActionID, ProjectNum, and
MaxTaskDueDate

The second subform(TaskSubform) has four : TaskID, ActionID, ProjectNum,
DueDate.

First of all, make sure your relationships are correct. The data source for
ActionSubform should be a query like this::

SELECT DISTINCTROW tblActionItems.TaskID, tblActionItems.ProjectNum
Max(tblTasks.DueDate) AS [MaxTaskDueDate]
FROM tblActionItems INNER JOIN tblTasks ON (( tblActionItems.ActionID=
tblTasks.ActionID) AND (tblActionItems.ProjectNum= tblTasks.ProjectNum))
GROUP BY tblActionItems.TaskID, ProjectNum;

The query for the Main form should be similiar but this time maxing the
MaxTaskDueDate. Give it a try and let us know if you need more help.

Also, I would create TaskSubform as a subform of ActionSubform first, then
placing that form as a subform of the main form. Rather than using
ActionSubform and TaskSubform as subforms of Main form.

Good luck.
 
G

gregc

Ok, right direction but the data is not passing.
the main form is called frm Project Data Entry Form and is based off table
tblProjectList the form has the following necessary fields Projectnum,
DeliverableDueDate.
The first subform is tblworkpacksubform based on the table tblworkpackage
(formally called tblActionItem) this subform has the following necessary
fields Projectnum, WPID, DueDate.
The subform attached to tblworkpacksubform is tbltasks subform, this subform
has the following necessary fields Projectnum, WPID, TaskID, DueDate.

What i need to do is when a Task Due date is change the data needs to be
requeried to check for the maximum date for the tasks and then fill in the
Work package due date with the maximum date found, then take and query the
work package due dates and fill in the Project Due date with that maximum
date.

I hope this clears up what i need, thank you in advance
Greg


Powderfinger said:
Let me get this straight.

The Main form has two important fields: ProjectNum and MaxActionIDDueDate.

The first subform (ActionSubform) has three: ActionID, ProjectNum, and
MaxTaskDueDate

The second subform(TaskSubform) has four : TaskID, ActionID, ProjectNum,
DueDate.

First of all, make sure your relationships are correct. The data source for
ActionSubform should be a query like this::

SELECT DISTINCTROW tblActionItems.TaskID, tblActionItems.ProjectNum
Max(tblTasks.DueDate) AS [MaxTaskDueDate]
FROM tblActionItems INNER JOIN tblTasks ON (( tblActionItems.ActionID=
tblTasks.ActionID) AND (tblActionItems.ProjectNum= tblTasks.ProjectNum))
GROUP BY tblActionItems.TaskID, ProjectNum;

The query for the Main form should be similiar but this time maxing the
MaxTaskDueDate. Give it a try and let us know if you need more help.

Also, I would create TaskSubform as a subform of ActionSubform first, then
placing that form as a subform of the main form. Rather than using
ActionSubform and TaskSubform as subforms of Main form.

Good luck.








gregc said:
I have a access 2003 database for project tracking, it has 3 tables with
ProjectNum being the link for all 3.
I have subforms on a main form that display information related to the
project, the 1st subform has the Action items with an actionid,and
projectnum, the 2nd form has the tasks with an taskid, actionid and
projectnum, each task have due dates, what i want to do is take the tasks due
date maximum date value: ie 8/21/2006 for a group of tasks with different due
dates and pass that data to the the action item duedate field on the action
item subform, and then the maximum date on the action item subform for each
of the action items to the main form's duedate feild for each project using
the same maximum value. any coding suggestions would be great, i am sure
there will be questions so let me know.
Thanks
Greg
 
P

Powderfinger

Try adding this in the AfterUpdate event of the TaskDueDate.

DoCmd.RunCommand acCmdSaveRecord
[Forms]![Project Data Entry Form].Requery

You might lose your place in the record. There are workarounds if that
happens.

gregc said:
Ok, right direction but the data is not passing.
the main form is called frm Project Data Entry Form and is based off table
tblProjectList the form has the following necessary fields Projectnum,
DeliverableDueDate.
The first subform is tblworkpacksubform based on the table tblworkpackage
(formally called tblActionItem) this subform has the following necessary
fields Projectnum, WPID, DueDate.
The subform attached to tblworkpacksubform is tbltasks subform, this subform
has the following necessary fields Projectnum, WPID, TaskID, DueDate.

What i need to do is when a Task Due date is change the data needs to be
requeried to check for the maximum date for the tasks and then fill in the
Work package due date with the maximum date found, then take and query the
work package due dates and fill in the Project Due date with that maximum
date.

I hope this clears up what i need, thank you in advance
Greg


Powderfinger said:
Let me get this straight.

The Main form has two important fields: ProjectNum and MaxActionIDDueDate.

The first subform (ActionSubform) has three: ActionID, ProjectNum, and
MaxTaskDueDate

The second subform(TaskSubform) has four : TaskID, ActionID, ProjectNum,
DueDate.

First of all, make sure your relationships are correct. The data source for
ActionSubform should be a query like this::

SELECT DISTINCTROW tblActionItems.TaskID, tblActionItems.ProjectNum
Max(tblTasks.DueDate) AS [MaxTaskDueDate]
FROM tblActionItems INNER JOIN tblTasks ON (( tblActionItems.ActionID=
tblTasks.ActionID) AND (tblActionItems.ProjectNum= tblTasks.ProjectNum))
GROUP BY tblActionItems.TaskID, ProjectNum;

The query for the Main form should be similiar but this time maxing the
MaxTaskDueDate. Give it a try and let us know if you need more help.

Also, I would create TaskSubform as a subform of ActionSubform first, then
placing that form as a subform of the main form. Rather than using
ActionSubform and TaskSubform as subforms of Main form.

Good luck.








gregc said:
I have a access 2003 database for project tracking, it has 3 tables with
ProjectNum being the link for all 3.
I have subforms on a main form that display information related to the
project, the 1st subform has the Action items with an actionid,and
projectnum, the 2nd form has the tasks with an taskid, actionid and
projectnum, each task have due dates, what i want to do is take the
tasks
due
date maximum date value: ie 8/21/2006 for a group of tasks with
different
due
dates and pass that data to the the action item duedate field on the action
item subform, and then the maximum date on the action item subform for each
of the action items to the main form's duedate feild for each project using
the same maximum value. any coding suggestions would be great, i am sure
there will be questions so let me know.
Thanks
Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top