Synchronizing subform question

  • Thread starter Thread starter Belinda7237
  • Start date Start date
B

Belinda7237

I have a mainform and a subform - i have created a relationship using one of
the fields.

These forms are used for data entry.
When I am on recrod 1 for the main form i want to stay insyc with record one
of the subform, but what is happening is the user will enter all of the
fields in the subform and the form will reset itself to blank for the next
record input, however the main form fields are not complete. Then, they will
attempt to restart the trecord and get a primary key error.

How do i keep them always in sync until they are ready to hit the save
record button at the end of the main form?
 
If you use an autonumber as the Primary Key for the main table and Foreign
Key for the related table, then set the Link Master/Child fields in the
subform, they will stay linked.

Typically, you need to fill out the main form first, then they many side
relationship data in the subform. You can force this, be making sure the
necessary fields in the main form are required. Also, it is a good idea to
have a default value in the required field if there is any possibility of
not being able to enter the data.
 
Belinda7237 said:
I have a mainform and a subform - i have created a relationship using one
of
the fields.

These forms are used for data entry.
When I am on recrod 1 for the main form i want to stay insyc with record
one
of the subform, but what is happening is the user will enter all of the
fields in the subform and the form will reset itself to blank for the next
record input, however the main form fields are not complete. Then, they
will
attempt to restart the trecord and get a primary key error.
How do i keep them always in sync until they are ready to hit the save
record button at the end of the main form?

In addition to Arvin's suggestion, I'd avise you set only the main form (if
that) to Data Entry mode, because you conceivably could be needing to enter
more than one related record in the Form embedded in the Subform Control and
it might well be useful to view the other records related to that main Form
record.

Most of my users/clients prefer to use normal Update, allowing Add (and
maybe Delete) rather than DataEntry. Sometimes I use a Command Button to
toggle between modes.

But, what's happening is that when you move from the main Form into the
Subform Control, the main Form is saved; when you move back from the Subform
to the main Form, the record in the Subform is saved, but you are
"re-entering" the main Form which, in Data Entry mode, means "new record".
Data Entry and Subforms can be, as you have found, "somewhat problematical".

Larry Linson
Microsoft Access MVP
 
I get what you are saying with the autonumber - and having only the main form
be set to data entry - where do i go to set it to normal update - i think i
may have had the forms set none data entry before but got an error saying
that i was creating a duplicate record, even though my subform is linked to
another table.
 

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

Back
Top