Cant Update Subform In a Form

G

Guest

I have a subform named "Work Orders - Materials Subform" within a parent form
called "Work Orders". The subforms link child fields and link master fields
are set to "Work Order ID". When you open the parent form it opens as a new
record therefore no work order ID is assigned to the parent form and subform.
When a user starts to input data, a work order ID is created in the parent
form but not in the subform. as a result of this the subform (Which is in
dataview) cant be edited. You have to close the parent form and then reopen
the parent form in order to be able to edit the subform.

Does anyone know how i can edit my subform without having to close and
reopen the parent form.

Thanks to anyone who looks into this.
 
J

John Vinson

I have a subform named "Work Orders - Materials Subform" within a parent form
called "Work Orders". The subforms link child fields and link master fields
are set to "Work Order ID". When you open the parent form it opens as a new
record therefore no work order ID is assigned to the parent form and subform.
When a user starts to input data, a work order ID is created in the parent
form but not in the subform. as a result of this the subform (Which is in
dataview) cant be edited. You have to close the parent form and then reopen
the parent form in order to be able to edit the subform.

Does anyone know how i can edit my subform without having to close and
reopen the parent form.

Thanks to anyone who looks into this.

Is the WorkOrderID an Autonumber field? If so, I'd suggest doing
SOMETHING to make the user enter data in some field - any field - on
the mainform prior to entering data on the subform.

If that's not practical, you could use the Subform's Load event to set
Parent!somecontrol to a value, thereby creating a record.

John W. Vinson[MVP]
 
G

Guest

John Vinson said:
Is the WorkOrderID an Autonumber field? If so, I'd suggest doing
SOMETHING to make the user enter data in some field - any field - on
the mainform prior to entering data on the subform.

If that's not practical, you could use the Subform's Load event to set
Parent!somecontrol to a value, thereby creating a record.

John W. Vinson[MVP]

What you have surgested i have done. The Work Order ID is an Autonumber.
When the parent form opens the first thing the user must do is to enter a
description of the job. The Work Order ID is then created from the
afterupdate event of the description field.

Any further ideas??
 
J

John Vinson

What you have surgested i have done. The Work Order ID is an Autonumber.
When the parent form opens the first thing the user must do is to enter a
description of the job. The Work Order ID is then created from the
afterupdate event of the description field.

No code should be needed to "create" a Work Order ID. If the main form
is bound to the workorder table, and if the job description is a field
in that table, then a new Work Order ID will be automatically created
with the very first keystroke in the description field.

You may be tripping over your own feet, trying to get Access to do
something it's already done! What is the Recordsource for the form?
What's the afterupdate code?

John W. Vinson[MVP]
 
G

Guest

John Vinson said:
No code should be needed to "create" a Work Order ID. If the main form
is bound to the workorder table, and if the job description is a field
in that table, then a new Work Order ID will be automatically created
with the very first keystroke in the description field.

You may be tripping over your own feet, trying to get Access to do
something it's already done! What is the Recordsource for the form?
What's the afterupdate code?

John W. Vinson[MVP]
I feel daft, the parent form is bound to a table work orders and thre is
infact no code for creating the autonumber. it is done with the first
keystroke as your say. therefore there is no code for the autonumber.
 
G

Guest

StuJol said:
I feel daft, the parent form is bound to a table work orders and thre is
infact no code for creating the autonumber. it is done with the first
keystroke as your say. therefore there is no code for the autonumber.

When i open the parent form there is no work order id created from the
autonumber, therefore the subform isnt linked to any work order id. When a
work order id is given to the main form via the autonumber, the work order id
number isnt transferred to the subform. You have to close the form and reopen
the form to link the main form and subform together via the work order id
number.
 
J

John Vinson

When i open the parent form there is no work order id created from the
autonumber, therefore the subform isnt linked to any work order id. When a
work order id is given to the main form via the autonumber, the work order id
number isnt transferred to the subform. You have to close the form and reopen
the form to link the main form and subform together via the work order id
number.

Doublecheck that the Subform control's Master Link Field is in fact
the name of the autonumber field in the parent table, and that its
Child Link Field is the name of the corresponding linking field in the
subform's table. It might be necessary to bind the child table's
linking field to a textbox on the subform (it can be invisible if you
wish) and use the name of that control as the child link field, though
I usually don't find this to be essential.

John W. Vinson[MVP]
 

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