Repost: Save record on other form

C

CJ

This was originally posted on March 23 at 11:14 pm.....sorry, I have a
deadline on this and am getting a little anxious on a few things.



Hi Groupies:

I have a continuous subform that keeps track of employee transactions
(fsubDailyBoxes). I have another subform visible (fsubEmpPay) that allows
the user to specify full or half day pay with yes/no fields for this
employee, full day is the default.

On fsubDailyBoxes, I select an employee from a combo box and it updates on
fsubEmpPay, the full day of pay is already selected but I can not get the
record to save.

I have tried setting the focus to fsubEmpPay and using
DoCmd.RunCommand acCmdSaveRecord to force the save but it did not work.

I have also tried using If me.dirty also without success.

I am obviously missing something critical.

Can somebody please fill me in on the details!
 
J

Jeff Boyce

Since most of the folks offering suggestions here are volunteering their
time, you might want to consider hiring someone if you are under a tight
deadline...

It all starts with the data. You described subforms, but not the data
structure(s) they're based on, nor the interrelationships (if any), and how
(if at all) they might be related to their respective main forms (also based
on some indeterminate data source).

More info, please...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
C

CJ

Hi Jeff, thanks for popping in!

Unfortunately, where I live, there are no other consultants to hire, I'm
it!!

The database is for tree planters. Planters receive a specified amount per
tree planted, based on the project, the terrain and the type of tree.

First the user selects the project and the planting areas. fsubDailyBoxes
basically keeps track of the trees planted per employee in that selected
block. fsubEmpPay is not a subform of fsubDailyBoxes, it resides on the main
form since a continuous sub can not have a sub. It is related via the main
form Project ID as well as the EmpID and Date from fsubDailyBoxes. If an
employee has planted a tree, it is assumed that they have shown up to work
either for a full or half day. The camp managers do not want to have to go
to a separate form to enter the planters attendance, as they do with the
other employee types.

In the OnChange event of my employee combo box, I have a simple requery
statement that requery's fsubEmpPay so that the correct employee is
selected. I also have the same requery in the OnCurrent of my main form so
that when I move between employees it shows their correct full/half day pay.

So, what I would like to happen is this: When an employee is selected and
planting data is entered on fsubDailyBoxes, I would like fsubEmpPay to
recognize that fact and save the employees day pay. (Full Day is selected as
a default).

I mean I could have no default and make them select either full or half but
I know that they are going to ask for it anyway.

I hope that's enough info.

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!


Jeff Boyce said:
Since most of the folks offering suggestions here are volunteering their
time, you might want to consider hiring someone if you are under a tight
deadline...

It all starts with the data. You described subforms, but not the data
structure(s) they're based on, nor the interrelationships (if any), and
how (if at all) they might be related to their respective main forms (also
based on some indeterminate data source).

More info, please...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

Jeff Boyce

I'm a little stacked-up right now, so I'll take a look a little later this
morning and offer my ideas. Perhaps one of the other newsgroup
readers/volunteers will have more time right away.

With this marvelous invention we're using (the Internet), it's possible to
have and support customers in different time zones (and different
countries!) without having to live in the same town... (personal experience
speaking!).

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP

CJ said:
Hi Jeff, thanks for popping in!

Unfortunately, where I live, there are no other consultants to hire, I'm
it!!

The database is for tree planters. Planters receive a specified amount per
tree planted, based on the project, the terrain and the type of tree.

First the user selects the project and the planting areas. fsubDailyBoxes
basically keeps track of the trees planted per employee in that selected
block. fsubEmpPay is not a subform of fsubDailyBoxes, it resides on the
main form since a continuous sub can not have a sub. It is related via the
main form Project ID as well as the EmpID and Date from fsubDailyBoxes. If
an employee has planted a tree, it is assumed that they have shown up to
work either for a full or half day. The camp managers do not want to have
to go to a separate form to enter the planters attendance, as they do with
the other employee types.

In the OnChange event of my employee combo box, I have a simple requery
statement that requery's fsubEmpPay so that the correct employee is
selected. I also have the same requery in the OnCurrent of my main form so
that when I move between employees it shows their correct full/half day
pay.

So, what I would like to happen is this: When an employee is selected and
planting data is entered on fsubDailyBoxes, I would like fsubEmpPay to
recognize that fact and save the employees day pay. (Full Day is selected
as a default).

I mean I could have no default and make them select either full or half
but I know that they are going to ask for it anyway.

I hope that's enough info.
 
J

Jeff Boyce

I took another look and I'm still having trouble visualizing the table
structure.

You've described how the form and subforms are supposed to look/work, but
forms are just glimpses of the underlying data.

Please post back with a more complete description of the data structure,
rather than the form design.

Thanks.

Regards

Jeff Boyce
Microsoft Office/Access MVP

CJ said:
Hi Jeff, thanks for popping in!

Unfortunately, where I live, there are no other consultants to hire, I'm
it!!

The database is for tree planters. Planters receive a specified amount per
tree planted, based on the project, the terrain and the type of tree.

First the user selects the project and the planting areas. fsubDailyBoxes
basically keeps track of the trees planted per employee in that selected
block. fsubEmpPay is not a subform of fsubDailyBoxes, it resides on the
main form since a continuous sub can not have a sub. It is related via the
main form Project ID as well as the EmpID and Date from fsubDailyBoxes. If
an employee has planted a tree, it is assumed that they have shown up to
work either for a full or half day. The camp managers do not want to have
to go to a separate form to enter the planters attendance, as they do with
the other employee types.

In the OnChange event of my employee combo box, I have a simple requery
statement that requery's fsubEmpPay so that the correct employee is
selected. I also have the same requery in the OnCurrent of my main form so
that when I move between employees it shows their correct full/half day
pay.

So, what I would like to happen is this: When an employee is selected and
planting data is entered on fsubDailyBoxes, I would like fsubEmpPay to
recognize that fact and save the employees day pay. (Full Day is selected
as a default).

I mean I could have no default and make them select either full or half
but I know that they are going to ask for it anyway.

I hope that's enough info.
 
C

CJ

Hi Jeff

Well, to give it a go in it's simplest terms.....the key tables involved
here are:

tblProjects keeps track of the client and overall project info
tblBlocks keeps track of the planting areas for the project
tblProjectStaff is a list of the crew selected for this project
tblDailyBoxes is a list of what each person planted on a particular day
tblCampCosts is a payroll table listing each staff persons attendance and
camp expenses for each day.

frmDailyMain based on tblProjects is the Main form
fsubBlockTU is the first subform showing which Block and Terrain area was
selected
fsubDailyBoxes is a subform on fsubBlockTU. It is based on a query that
allows me to select the employee, date, tree species,
number of boxes planted and rate per tree
fsubEmpPay is also a subform on fsubBlockTU. It is based on tblCampCosts and
allows me to match the employee ID, date and select either a full or half
day of pay.

Everything works fine relationship wise and the data integrity is sound. I'm
just lacking in the VB end of things. I was thinking that I had used some
code in a different database that ensures that a value is selected and
forces saving a record on a different related form. I just can't find (or
remember) the code. I thought it was pretty simple but perhaps that was a
pipe dream......
 
J

Jeff Boyce

OK, that helps me see a bit of the bigger picture.

You had mentioned that you have a subform that is related to the Project
(from the Main form) and to an Employee (from another subform). How have
you "related" these? It sounds like you know about using a main
form/subform relationship (parent/child field(s)), but how are you reaching
into the other subform to relate?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
C

CJ

fsubBlockTU is related to frmDailyMain via lngBlockID in both Child and
Master (This is where I select the planting block for the Project)

fsubDailyBoxes is related to fsubBlockTU via lngBlockAreaID in both Child
and Master (Selection of the terrain area within the block)

fsubEmpPay is related with lngProjID;lngEmpID;dtmDate in the Child and
[Forms]![frmDailyMain]![lngProjectID];[Forms]![frmDailyMain]![fsubBlockTU]![fsubDailyBoxes]![lngEmpID];[Forms]![frmDailyMain]![fsubBlockTU]![fsubDailyBoxes]![dtmDate]
in the Master (The correct Project, Employee and Date. The block location
does not matter for the days pay and can be retrieved via the fsubDailyBoxes
anyway)

HTH
 
J

Jeff Boyce

Whoops! I got lost again.

Are you saying you have a subform and a subsubform? I (?mis-)understood you
to describe one main form with two subforms.

Regards

Jeff Boyce
Microsoft Office/Access MVP

CJ said:
fsubBlockTU is related to frmDailyMain via lngBlockID in both Child and
Master (This is where I select the planting block for the Project)

fsubDailyBoxes is related to fsubBlockTU via lngBlockAreaID in both Child
and Master (Selection of the terrain area within the block)

fsubEmpPay is related with lngProjID;lngEmpID;dtmDate in the Child and
[Forms]![frmDailyMain]![lngProjectID];[Forms]![frmDailyMain]![fsubBlockTU]![fsubDailyBoxes]![lngEmpID];[Forms]![frmDailyMain]![fsubBlockTU]![fsubDailyBoxes]![dtmDate]
in the Master (The correct Project, Employee and Date. The block location
does not matter for the days pay and can be retrieved via the
fsubDailyBoxes anyway)

HTH

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!


Jeff Boyce said:
OK, that helps me see a bit of the bigger picture.

You had mentioned that you have a subform that is related to the Project
(from the Main form) and to an Employee (from another subform). How have
you "related" these? It sounds like you know about using a main
form/subform relationship (parent/child field(s)), but how are you
reaching into the other subform to relate?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
C

CJ

Sorry, it is one main with two subs. fsubEmpPay is sitting on (in?)
fsubBlockTU and is related as below.

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Jeff Boyce said:
Whoops! I got lost again.

Are you saying you have a subform and a subsubform? I (?mis-)understood
you to describe one main form with two subforms.

Regards

Jeff Boyce
Microsoft Office/Access MVP

CJ said:
fsubBlockTU is related to frmDailyMain via lngBlockID in both Child and
Master (This is where I select the planting block for the Project)

fsubDailyBoxes is related to fsubBlockTU via lngBlockAreaID in both Child
and Master (Selection of the terrain area within the block)

fsubEmpPay is related with lngProjID;lngEmpID;dtmDate in the Child and
[Forms]![frmDailyMain]![lngProjectID];[Forms]![frmDailyMain]![fsubBlockTU]![fsubDailyBoxes]![lngEmpID];[Forms]![frmDailyMain]![fsubBlockTU]![fsubDailyBoxes]![dtmDate]
in the Master (The correct Project, Employee and Date. The block location
does not matter for the days pay and can be retrieved via the
fsubDailyBoxes anyway)

HTH
 
J

Jeff Boyce

I'm still not visualizing your situation. Perhaps it's a matter of
semantics.

A "subform" is dependent on its parent form. Please describe the "parents"
and "children" forms you are working with.

I can't tell if you have one parent with two children, or a parent, a child,
and a grandchild.

Regards

Jeff Boyce
Microsoft Office/Access MVP

CJ said:
Sorry, it is one main with two subs. fsubEmpPay is sitting on (in?)
fsubBlockTU and is related as below.

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Jeff Boyce said:
Whoops! I got lost again.

Are you saying you have a subform and a subsubform? I (?mis-)understood
you to describe one main form with two subforms.

Regards

Jeff Boyce
Microsoft Office/Access MVP

CJ said:
fsubBlockTU is related to frmDailyMain via lngBlockID in both Child and
Master (This is where I select the planting block for the Project)

fsubDailyBoxes is related to fsubBlockTU via lngBlockAreaID in both
Child and Master (Selection of the terrain area within the block)

fsubEmpPay is related with lngProjID;lngEmpID;dtmDate in the Child and
[Forms]![frmDailyMain]![lngProjectID];[Forms]![frmDailyMain]![fsubBlockTU]![fsubDailyBoxes]![lngEmpID];[Forms]![frmDailyMain]![fsubBlockTU]![fsubDailyBoxes]![dtmDate]
in the Master (The correct Project, Employee and Date. The block
location does not matter for the days pay and can be retrieved via the
fsubDailyBoxes anyway)

HTH

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!


OK, that helps me see a bit of the bigger picture.

You had mentioned that you have a subform that is related to the
Project (from the Main form) and to an Employee (from another subform).
How have you "related" these? It sounds like you know about using a
main form/subform relationship (parent/child field(s)), but how are you
reaching into the other subform to relate?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Hi Jeff

Well, to give it a go in it's simplest terms.....the key tables
involved here are:

tblProjects keeps track of the client and overall project info
tblBlocks keeps track of the planting areas for the project
tblProjectStaff is a list of the crew selected for this project
tblDailyBoxes is a list of what each person planted on a particular
day
tblCampCosts is a payroll table listing each staff persons attendance
and camp expenses for each day.

frmDailyMain based on tblProjects is the Main form
fsubBlockTU is the first subform showing which Block and Terrain area
was selected
fsubDailyBoxes is a subform on fsubBlockTU. It is based on a query
that allows me to select the employee, date, tree species,
number of boxes planted and rate per tree
fsubEmpPay is also a subform on fsubBlockTU. It is based on
tblCampCosts and allows me to match the employee ID, date and select
either a full or half day of pay.

Everything works fine relationship wise and the data integrity is
sound. I'm just lacking in the VB end of things. I was thinking that I
had used some code in a different database that ensures that a value
is selected and forces saving a record on a different related form. I
just can't find (or remember) the code. I thought it was pretty simple
but perhaps that was a pipe dream......

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!

I took another look and I'm still having trouble visualizing the table
structure.

You've described how the form and subforms are supposed to look/work,
but forms are just glimpses of the underlying data.

Please post back with a more complete description of the data
structure, rather than the form design.

Thanks.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Hi Jeff, thanks for popping in!

Unfortunately, where I live, there are no other consultants to hire,
I'm it!!

The database is for tree planters. Planters receive a specified
amount per tree planted, based on the project, the terrain and the
type of tree.

First the user selects the project and the planting areas.
fsubDailyBoxes basically keeps track of the trees planted per
employee in that selected block. fsubEmpPay is not a subform of
fsubDailyBoxes, it resides on the main form since a continuous sub
can not have a sub. It is related via the main form Project ID as
well as the EmpID and Date from fsubDailyBoxes. If an employee has
planted a tree, it is assumed that they have shown up to work either
for a full or half day. The camp managers do not want to have to go
to a separate form to enter the planters attendance, as they do with
the other employee types.

In the OnChange event of my employee combo box, I have a simple
requery statement that requery's fsubEmpPay so that the correct
employee is selected. I also have the same requery in the OnCurrent
of my main form so that when I move between employees it shows their
correct full/half day pay.

So, what I would like to happen is this: When an employee is
selected and planting data is entered on fsubDailyBoxes, I would
like fsubEmpPay to recognize that fact and save the employees day
pay. (Full Day is selected as a default).

I mean I could have no default and make them select either full or
half but I know that they are going to ask for it anyway.

I hope that's enough info.

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!


Since most of the folks offering suggestions here are volunteering
their time, you might want to consider hiring someone if you are
under a tight deadline...

It all starts with the data. You described subforms, but not the
data structure(s) they're based on, nor the interrelationships (if
any), and how (if at all) they might be related to their respective
main forms (also based on some indeterminate data source).

More info, please...

Regards

Jeff Boyce
Microsoft Office/Access MVP

This was originally posted on March 23 at 11:14 pm.....sorry, I
have a deadline on this and am getting a little anxious on a few
things.



Hi Groupies:

I have a continuous subform that keeps track of employee
transactions
(fsubDailyBoxes). I have another subform visible (fsubEmpPay) that
allows
the user to specify full or half day pay with yes/no fields for
this
employee, full day is the default.

On fsubDailyBoxes, I select an employee from a combo box and it
updates on
fsubEmpPay, the full day of pay is already selected but I can not
get the
record to save.

I have tried setting the focus to fsubEmpPay and using
DoCmd.RunCommand acCmdSaveRecord to force the save but it did
not work.

I have also tried using If me.dirty also without success.

I am obviously missing something critical.

Can somebody please fill me in on the details!
 
C

CJ

Hello again.

frmDailyMain is the parent
fsubBlockTU is the child
fsubDailyBoxes and fsubEmpPay are both grandchildren, there are no Great
Grandchildren.

As I mentioned in my second post, I would love to make fsubEmpPay a Great
Grandchild but fsubDailyBoxes is a continuous subform (and needs to stay that
way) and cannot have a sub.
Therefore, I needed to manipulate the Child/Master relationship of
fsubEmpPay so that it would recognize the correct employee and date from
fsubDailyBoxes.


--
Thanks for the brainwaves!

CJ
I blame the parents........


Jeff Boyce said:
I'm still not visualizing your situation. Perhaps it's a matter of
semantics.

A "subform" is dependent on its parent form. Please describe the "parents"
and "children" forms you are working with.

I can't tell if you have one parent with two children, or a parent, a child,
and a grandchild.

Regards

Jeff Boyce
Microsoft Office/Access MVP

CJ said:
Sorry, it is one main with two subs. fsubEmpPay is sitting on (in?)
fsubBlockTU and is related as below.

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Jeff Boyce said:
Whoops! I got lost again.

Are you saying you have a subform and a subsubform? I (?mis-)understood
you to describe one main form with two subforms.

Regards

Jeff Boyce
Microsoft Office/Access MVP

fsubBlockTU is related to frmDailyMain via lngBlockID in both Child and
Master (This is where I select the planting block for the Project)

fsubDailyBoxes is related to fsubBlockTU via lngBlockAreaID in both
Child and Master (Selection of the terrain area within the block)

fsubEmpPay is related with lngProjID;lngEmpID;dtmDate in the Child and
[Forms]![frmDailyMain]![lngProjectID];[Forms]![frmDailyMain]![fsubBlockTU]![fsubDailyBoxes]![lngEmpID];[Forms]![frmDailyMain]![fsubBlockTU]![fsubDailyBoxes]![dtmDate]
in the Master (The correct Project, Employee and Date. The block
location does not matter for the days pay and can be retrieved via the
fsubDailyBoxes anyway)

HTH

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!


OK, that helps me see a bit of the bigger picture.

You had mentioned that you have a subform that is related to the
Project (from the Main form) and to an Employee (from another subform).
How have you "related" these? It sounds like you know about using a
main form/subform relationship (parent/child field(s)), but how are you
reaching into the other subform to relate?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Hi Jeff

Well, to give it a go in it's simplest terms.....the key tables
involved here are:

tblProjects keeps track of the client and overall project info
tblBlocks keeps track of the planting areas for the project
tblProjectStaff is a list of the crew selected for this project
tblDailyBoxes is a list of what each person planted on a particular
day
tblCampCosts is a payroll table listing each staff persons attendance
and camp expenses for each day.

frmDailyMain based on tblProjects is the Main form
fsubBlockTU is the first subform showing which Block and Terrain area
was selected
fsubDailyBoxes is a subform on fsubBlockTU. It is based on a query
that allows me to select the employee, date, tree species,
number of boxes planted and rate per tree
fsubEmpPay is also a subform on fsubBlockTU. It is based on
tblCampCosts and allows me to match the employee ID, date and select
either a full or half day of pay.

Everything works fine relationship wise and the data integrity is
sound. I'm just lacking in the VB end of things. I was thinking that I
had used some code in a different database that ensures that a value
is selected and forces saving a record on a different related form. I
just can't find (or remember) the code. I thought it was pretty simple
but perhaps that was a pipe dream......

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!

I took another look and I'm still having trouble visualizing the table
structure.

You've described how the form and subforms are supposed to look/work,
but forms are just glimpses of the underlying data.

Please post back with a more complete description of the data
structure, rather than the form design.

Thanks.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Hi Jeff, thanks for popping in!

Unfortunately, where I live, there are no other consultants to hire,
I'm it!!

The database is for tree planters. Planters receive a specified
amount per tree planted, based on the project, the terrain and the
type of tree.

First the user selects the project and the planting areas.
fsubDailyBoxes basically keeps track of the trees planted per
employee in that selected block. fsubEmpPay is not a subform of
fsubDailyBoxes, it resides on the main form since a continuous sub
can not have a sub. It is related via the main form Project ID as
well as the EmpID and Date from fsubDailyBoxes. If an employee has
planted a tree, it is assumed that they have shown up to work either
for a full or half day. The camp managers do not want to have to go
to a separate form to enter the planters attendance, as they do with
the other employee types.

In the OnChange event of my employee combo box, I have a simple
requery statement that requery's fsubEmpPay so that the correct
employee is selected. I also have the same requery in the OnCurrent
of my main form so that when I move between employees it shows their
correct full/half day pay.

So, what I would like to happen is this: When an employee is
selected and planting data is entered on fsubDailyBoxes, I would
like fsubEmpPay to recognize that fact and save the employees day
pay. (Full Day is selected as a default).

I mean I could have no default and make them select either full or
half but I know that they are going to ask for it anyway.

I hope that's enough info.

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!


Since most of the folks offering suggestions here are volunteering
their time, you might want to consider hiring someone if you are
under a tight deadline...

It all starts with the data. You described subforms, but not the
data structure(s) they're based on, nor the interrelationships (if
any), and how (if at all) they might be related to their respective
main forms (also based on some indeterminate data source).

More info, please...

Regards

Jeff Boyce
Microsoft Office/Access MVP

This was originally posted on March 23 at 11:14 pm.....sorry, I
have a deadline on this and am getting a little anxious on a few
things.



Hi Groupies:

I have a continuous subform that keeps track of employee
transactions
(fsubDailyBoxes). I have another subform visible (fsubEmpPay) that
allows
the user to specify full or half day pay with yes/no fields for
this
employee, full day is the default.

On fsubDailyBoxes, I select an employee from a combo box and it
updates on
fsubEmpPay, the full day of pay is already selected but I can not
get the
record to save.

I have tried setting the focus to fsubEmpPay and using
DoCmd.RunCommand acCmdSaveRecord to force the save but it did
not work.

I have also tried using If me.dirty also without success.

I am obviously missing something critical.

Can somebody please fill me in on the details!
 
C

CJ

Hello again.

frmDailyMain is the parent
fsubBlockTU is the child
fsubDailyBoxes and fsubEmpPay are both grandchildren, there are no Great
Grandchildren.

As I mentioned in my second post, I would love to make fsubEmpPay a Great
Grandchild but fsubDailyBoxes is a continuous subform (and needs to stay that
way) and cannot have a sub.
Therefore, I needed to manipulate the Child/Master relationship of
fsubEmpPay so that it would recognize the correct employee and date from
fsubDailyBoxes.


--
Thanks for the brainwaves!

CJ
I blame the parents........


Jeff Boyce said:
I'm still not visualizing your situation. Perhaps it's a matter of
semantics.

A "subform" is dependent on its parent form. Please describe the "parents"
and "children" forms you are working with.

I can't tell if you have one parent with two children, or a parent, a child,
and a grandchild.

Regards

Jeff Boyce
Microsoft Office/Access MVP

CJ said:
Sorry, it is one main with two subs. fsubEmpPay is sitting on (in?)
fsubBlockTU and is related as below.

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Jeff Boyce said:
Whoops! I got lost again.

Are you saying you have a subform and a subsubform? I (?mis-)understood
you to describe one main form with two subforms.

Regards

Jeff Boyce
Microsoft Office/Access MVP

fsubBlockTU is related to frmDailyMain via lngBlockID in both Child and
Master (This is where I select the planting block for the Project)

fsubDailyBoxes is related to fsubBlockTU via lngBlockAreaID in both
Child and Master (Selection of the terrain area within the block)

fsubEmpPay is related with lngProjID;lngEmpID;dtmDate in the Child and
[Forms]![frmDailyMain]![lngProjectID];[Forms]![frmDailyMain]![fsubBlockTU]![fsubDailyBoxes]![lngEmpID];[Forms]![frmDailyMain]![fsubBlockTU]![fsubDailyBoxes]![dtmDate]
in the Master (The correct Project, Employee and Date. The block
location does not matter for the days pay and can be retrieved via the
fsubDailyBoxes anyway)

HTH

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!


OK, that helps me see a bit of the bigger picture.

You had mentioned that you have a subform that is related to the
Project (from the Main form) and to an Employee (from another subform).
How have you "related" these? It sounds like you know about using a
main form/subform relationship (parent/child field(s)), but how are you
reaching into the other subform to relate?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Hi Jeff

Well, to give it a go in it's simplest terms.....the key tables
involved here are:

tblProjects keeps track of the client and overall project info
tblBlocks keeps track of the planting areas for the project
tblProjectStaff is a list of the crew selected for this project
tblDailyBoxes is a list of what each person planted on a particular
day
tblCampCosts is a payroll table listing each staff persons attendance
and camp expenses for each day.

frmDailyMain based on tblProjects is the Main form
fsubBlockTU is the first subform showing which Block and Terrain area
was selected
fsubDailyBoxes is a subform on fsubBlockTU. It is based on a query
that allows me to select the employee, date, tree species,
number of boxes planted and rate per tree
fsubEmpPay is also a subform on fsubBlockTU. It is based on
tblCampCosts and allows me to match the employee ID, date and select
either a full or half day of pay.

Everything works fine relationship wise and the data integrity is
sound. I'm just lacking in the VB end of things. I was thinking that I
had used some code in a different database that ensures that a value
is selected and forces saving a record on a different related form. I
just can't find (or remember) the code. I thought it was pretty simple
but perhaps that was a pipe dream......

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!

I took another look and I'm still having trouble visualizing the table
structure.

You've described how the form and subforms are supposed to look/work,
but forms are just glimpses of the underlying data.

Please post back with a more complete description of the data
structure, rather than the form design.

Thanks.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Hi Jeff, thanks for popping in!

Unfortunately, where I live, there are no other consultants to hire,
I'm it!!

The database is for tree planters. Planters receive a specified
amount per tree planted, based on the project, the terrain and the
type of tree.

First the user selects the project and the planting areas.
fsubDailyBoxes basically keeps track of the trees planted per
employee in that selected block. fsubEmpPay is not a subform of
fsubDailyBoxes, it resides on the main form since a continuous sub
can not have a sub. It is related via the main form Project ID as
well as the EmpID and Date from fsubDailyBoxes. If an employee has
planted a tree, it is assumed that they have shown up to work either
for a full or half day. The camp managers do not want to have to go
to a separate form to enter the planters attendance, as they do with
the other employee types.

In the OnChange event of my employee combo box, I have a simple
requery statement that requery's fsubEmpPay so that the correct
employee is selected. I also have the same requery in the OnCurrent
of my main form so that when I move between employees it shows their
correct full/half day pay.

So, what I would like to happen is this: When an employee is
selected and planting data is entered on fsubDailyBoxes, I would
like fsubEmpPay to recognize that fact and save the employees day
pay. (Full Day is selected as a default).

I mean I could have no default and make them select either full or
half but I know that they are going to ask for it anyway.

I hope that's enough info.

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!


Since most of the folks offering suggestions here are volunteering
their time, you might want to consider hiring someone if you are
under a tight deadline...

It all starts with the data. You described subforms, but not the
data structure(s) they're based on, nor the interrelationships (if
any), and how (if at all) they might be related to their respective
main forms (also based on some indeterminate data source).

More info, please...

Regards

Jeff Boyce
Microsoft Office/Access MVP

This was originally posted on March 23 at 11:14 pm.....sorry, I
have a deadline on this and am getting a little anxious on a few
things.



Hi Groupies:

I have a continuous subform that keeps track of employee
transactions
(fsubDailyBoxes). I have another subform visible (fsubEmpPay) that
allows
the user to specify full or half day pay with yes/no fields for
this
employee, full day is the default.

On fsubDailyBoxes, I select an employee from a combo box and it
updates on
fsubEmpPay, the full day of pay is already selected but I can not
get the
record to save.

I have tried setting the focus to fsubEmpPay and using
DoCmd.RunCommand acCmdSaveRecord to force the save but it did
not work.

I have also tried using If me.dirty also without success.

I am obviously missing something critical.

Can somebody please fill me in on the details!
 

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