check empty subform

  • Thread starter Thread starter spring
  • Start date Start date
S

spring

I have two subforms:

one for main and one for detail.

If the main subform is filled, it should not be able to jump to other
records until the detail subform is also filled.

I have tried to check it in BeforeUpdate in main subform, but it even
prevents me jumping to the detail subform.
I also tried in Current, but it cannot Cancel the navigating operation.

Any hints will be appreciated.
 
Hi spring,
one way to force this is to open the main form to a single record.
If the main form can't go to a different record or another new record, the
only options left for the user are to close the main form or fill in the
detail subform.

I am assuming that your description of --> I have two subforms:
one for main and one for detail. --> means one main form with one subform.

To open the main form to add only one new record, make allow additions set
to no and data entry set to no for the main form.
Open the form with this code:
DoCmd.OpenForm "NameOfForm", DataMode:=acAdd

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
Oops - that should be
acFormAdd

Replace
DoCmd.OpenForm "NameOfForm", DataMode:=acAdd

with

DoCmd.OpenForm "NameOfForm", DataMode:=acFormAdd

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
Thanks Jeanette.

actually i have those two subforms on a bigger form.
the two subforms are linked.

Also I need to change previous records.
 
Assuming that the main form is bound to a table on the 'one' side of a one
to many relationship and the subform is bound to the 'many' side of the same
relationship, that makes it much more difficult. I don't really know what to
suggest. The main form can have many subform records for the same record of
the main form.
Access is not intended to be used the way you are suggesting - access is
deliberately set up so that you can enter many child records for the same
record in the parent form. Hopefully someone else can jump in here with an
idea.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
that's exactly the case.

maybe I should restart from designing the forms.
maybe I can just drop this idea.

Jeanette, thanks very much for your help!
 
Back
Top