Subform Wants Main Form Record Updated First

R

ridgerunner

I know I saw a post about this, but I can't find it. After entering data
into the main form, and then attempting to enter data into the subform
fields, the subform seems to need the main form record entered first. How do
I solve this?
 
A

Arvin Meyer [MVP]

The main form data is on the one side of a relationship. The subform data is
on the many side. You must fill in all the required information on the one
side before you can work on the many side.

The only possible solution is to require less information on the one side,
or supply the required information.
 
R

ridgerunner

Is there a property on the main form that will make it update the underlying
database before data entry is begun on the subform?
 
R

ridgerunner

I'm not certain I understand what Dirty means, but when I enter data to the
main form and move to the subform I guess the subform can't 'see' that I have
entered data into the main form. I say that because that is when I get the
message "you cannot add or change a record because a related record is
required in table "tblDMIspections", which is the underlying table to the
main form.

I am receivng another error box that may be related to the first problem.
This occurs when I attempt to enter data into a field in the subform.

"You can't assign a value to this object"
*The object may be a control on a read-only form
*The object may be on a form this open in Design view
*The value may be too large for this field.

None of the above conditions are true. Any help is greatly appreciated.

ruralguy via AccessMonster.com said:
When the Current Record is Dirty, it *will* be saved before you can move the
focus to the SubForm.
Is there a property on the main form that will make it update the underlying
database before data entry is begun on the subform?
The main form data is on the one side of a relationship. The subform data is
on the many side. You must fill in all the required information on the one
[quoted text clipped - 7 lines]
do
I solve this?

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
A

Arvin Meyer [MVP]

One of 2 things may be happening.
1. The mainform does not have an updateable recordsource (or maybe not bound
at all) or more likely:
2. There is no link between the main and subform.

Dirty means that enough information has been entered to allow records to be
saved, and that you do not have your Warnings turned off in your code
somewhere without turning them back on.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

ridgerunner said:
I'm not certain I understand what Dirty means, but when I enter data to
the
main form and move to the subform I guess the subform can't 'see' that I
have
entered data into the main form. I say that because that is when I get
the
message "you cannot add or change a record because a related record is
required in table "tblDMIspections", which is the underlying table to the
main form.

I am receivng another error box that may be related to the first problem.
This occurs when I attempt to enter data into a field in the subform.

"You can't assign a value to this object"
*The object may be a control on a read-only form
*The object may be on a form this open in Design view
*The value may be too large for this field.

None of the above conditions are true. Any help is greatly appreciated.

ruralguy via AccessMonster.com said:
When the Current Record is Dirty, it *will* be saved before you can move
the
focus to the SubForm.
Is there a property on the main form that will make it update the
underlying
database before data entry is begun on the subform?

The main form data is on the one side of a relationship. The subform
data is
on the many side. You must fill in all the required information on the
one
[quoted text clipped - 7 lines]
do
I solve this?

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
R

ridgerunner

1) The recordsource of the main form is updatable
2) There is relationship set up between the PK of the main form, which is an
auto field, and an ID field on the subform. The subform ID field gets it
data from the main form PK field. The link master fields and link child
fields are set to the PK of the main form and the ID field of the subform.

I really appreciate help with this as I am baffled. I just received John
Viescas' book "Microsoft Office Access 2003 Inside Out" to try and make sense
out of all of this. If anyone can point me to the appropriate sections of
the book that would be great. Did not realize it is over 1,000 pages.

Thanks for the description of Dirty. I have not knowingly turned off any
warnings.

ridgerunner

Arvin Meyer said:
One of 2 things may be happening.
1. The mainform does not have an updateable recordsource (or maybe not bound
at all) or more likely:
2. There is no link between the main and subform.

Dirty means that enough information has been entered to allow records to be
saved, and that you do not have your Warnings turned off in your code
somewhere without turning them back on.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

ridgerunner said:
I'm not certain I understand what Dirty means, but when I enter data to
the
main form and move to the subform I guess the subform can't 'see' that I
have
entered data into the main form. I say that because that is when I get
the
message "you cannot add or change a record because a related record is
required in table "tblDMIspections", which is the underlying table to the
main form.

I am receivng another error box that may be related to the first problem.
This occurs when I attempt to enter data into a field in the subform.

"You can't assign a value to this object"
*The object may be a control on a read-only form
*The object may be on a form this open in Design view
*The value may be too large for this field.

None of the above conditions are true. Any help is greatly appreciated.

ruralguy via AccessMonster.com said:
When the Current Record is Dirty, it *will* be saved before you can move
the
focus to the SubForm.

ridgerunner wrote:
Is there a property on the main form that will make it update the
underlying
database before data entry is begun on the subform?

The main form data is on the one side of a relationship. The subform
data is
on the many side. You must fill in all the required information on the
one
[quoted text clipped - 7 lines]
do
I solve this?

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
A

Arvin Meyer [MVP]

If you have any code, anywhere in your database, which reads:

DoCmd.SetWarnings False

and the exit routine doesn't turn them on again. Or you have a macro which
does the same. You must turn them back on and make sure that an error
doesn't keep them from being turned back on.

It is also possible that you have a required field in your table which isn't
being filled so the save doesn't take place.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

ridgerunner said:
1) The recordsource of the main form is updatable
2) There is relationship set up between the PK of the main form, which is
an
auto field, and an ID field on the subform. The subform ID field gets it
data from the main form PK field. The link master fields and link child
fields are set to the PK of the main form and the ID field of the subform.

I really appreciate help with this as I am baffled. I just received John
Viescas' book "Microsoft Office Access 2003 Inside Out" to try and make
sense
out of all of this. If anyone can point me to the appropriate sections of
the book that would be great. Did not realize it is over 1,000 pages.

Thanks for the description of Dirty. I have not knowingly turned off any
warnings.

ridgerunner

Arvin Meyer said:
One of 2 things may be happening.
1. The mainform does not have an updateable recordsource (or maybe not
bound
at all) or more likely:
2. There is no link between the main and subform.

Dirty means that enough information has been entered to allow records to
be
saved, and that you do not have your Warnings turned off in your code
somewhere without turning them back on.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

ridgerunner said:
I'm not certain I understand what Dirty means, but when I enter data to
the
main form and move to the subform I guess the subform can't 'see' that
I
have
entered data into the main form. I say that because that is when I get
the
message "you cannot add or change a record because a related record is
required in table "tblDMIspections", which is the underlying table to
the
main form.

I am receivng another error box that may be related to the first
problem.
This occurs when I attempt to enter data into a field in the subform.

"You can't assign a value to this object"
*The object may be a control on a read-only form
*The object may be on a form this open in Design view
*The value may be too large for this field.

None of the above conditions are true. Any help is greatly
appreciated.

:

When the Current Record is Dirty, it *will* be saved before you can
move
the
focus to the SubForm.

ridgerunner wrote:
Is there a property on the main form that will make it update the
underlying
database before data entry is begun on the subform?

The main form data is on the one side of a relationship. The
subform
data is
on the many side. You must fill in all the required information on
the
one
[quoted text clipped - 7 lines]
do
I solve this?

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
R

ridgerunner

I think I need to be certain when the save should take place. I am thinking
that once I enter the data on the main form and move to the subform that the
record in underlying table for the main form should automatically be saved.
Is this correct? Is there a property setting I need to check? Thanks for
your help.

Arvin Meyer said:
If you have any code, anywhere in your database, which reads:

DoCmd.SetWarnings False

and the exit routine doesn't turn them on again. Or you have a macro which
does the same. You must turn them back on and make sure that an error
doesn't keep them from being turned back on.

It is also possible that you have a required field in your table which isn't
being filled so the save doesn't take place.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

ridgerunner said:
1) The recordsource of the main form is updatable
2) There is relationship set up between the PK of the main form, which is
an
auto field, and an ID field on the subform. The subform ID field gets it
data from the main form PK field. The link master fields and link child
fields are set to the PK of the main form and the ID field of the subform.

I really appreciate help with this as I am baffled. I just received John
Viescas' book "Microsoft Office Access 2003 Inside Out" to try and make
sense
out of all of this. If anyone can point me to the appropriate sections of
the book that would be great. Did not realize it is over 1,000 pages.

Thanks for the description of Dirty. I have not knowingly turned off any
warnings.

ridgerunner

Arvin Meyer said:
One of 2 things may be happening.
1. The mainform does not have an updateable recordsource (or maybe not
bound
at all) or more likely:
2. There is no link between the main and subform.

Dirty means that enough information has been entered to allow records to
be
saved, and that you do not have your Warnings turned off in your code
somewhere without turning them back on.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

I'm not certain I understand what Dirty means, but when I enter data to
the
main form and move to the subform I guess the subform can't 'see' that
I
have
entered data into the main form. I say that because that is when I get
the
message "you cannot add or change a record because a related record is
required in table "tblDMIspections", which is the underlying table to
the
main form.

I am receivng another error box that may be related to the first
problem.
This occurs when I attempt to enter data into a field in the subform.

"You can't assign a value to this object"
*The object may be a control on a read-only form
*The object may be on a form this open in Design view
*The value may be too large for this field.

None of the above conditions are true. Any help is greatly
appreciated.

:

When the Current Record is Dirty, it *will* be saved before you can
move
the
focus to the SubForm.

ridgerunner wrote:
Is there a property on the main form that will make it update the
underlying
database before data entry is begun on the subform?

The main form data is on the one side of a relationship. The
subform
data is
on the many side. You must fill in all the required information on
the
one
[quoted text clipped - 7 lines]
do
I solve this?

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
R

ridgerunner

Thanks. I do not think the record save is automatically happening when I
leave the main form. Please excuse my ignorance, but, where do I put the
beforeupdate event and how should it be written.

ruralguy via AccessMonster.com said:
You are correct here. You would use the BeforeUpdate event to verify that
*all* of the fields are completed properly. Otherwise set Cancel = True to
hold the user in the MainForm until it is properly completed or use Me.UnDo
to remove any changes to the form.
I think I need to be certain when the save should take place. I am thinking
that once I enter the data on the main form and move to the subform that the
record in underlying table for the main form should automatically be saved.
Is this correct? Is there a property setting I need to check? Thanks for
your help.
If you have any code, anywhere in your database, which reads:
[quoted text clipped - 76 lines]
do
I solve this?

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
R

ridgerunner

I just set up a simple simulation on my machine at home and the subform and
form work like they are expected. There must be something out of order with
the working database and tables I have been setting up. Thanks for your
advice and patience.
ridgerunner

ridgerunner said:
Thanks. I do not think the record save is automatically happening when I
leave the main form. Please excuse my ignorance, but, where do I put the
beforeupdate event and how should it be written.

ruralguy via AccessMonster.com said:
You are correct here. You would use the BeforeUpdate event to verify that
*all* of the fields are completed properly. Otherwise set Cancel = True to
hold the user in the MainForm until it is properly completed or use Me.UnDo
to remove any changes to the form.
I think I need to be certain when the save should take place. I am thinking
that once I enter the data on the main form and move to the subform that the
record in underlying table for the main form should automatically be saved.
Is this correct? Is there a property setting I need to check? Thanks for
your help.

If you have any code, anywhere in your database, which reads:

[quoted text clipped - 76 lines]
do
I solve this?

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 

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