By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,455 Members | 2,157 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,455 IT Pros & Developers. It's quick & easy.

Subform not loading (I think)

P: n/a
Hi. I have a Main form with a subform that has a subform. I have an
'Add Event' button on the Main Form that issues the following
instruction:

DoCmd.GoToRecord , , acNewRec

If the record being displayed BEFORE the 'Add Event' button is clicked
does not have data to be displayed (no associated linked records) then
when the 'new record' is displayed, the innermost subform looks just
fine (all the controls are there and they are empty).

However, if the record being displayed BEFORE the 'Add Event' button is
clicked does have data to be displayed (there are associated linked
records) then when the 'new record' is displayed, the innermost subform
does not show the empty controls at all.

Any ideas why?

Some additional information:
I have the imbedded subforms 'disabled' (enabled=false) when the new
record is displayed. I want to force the user to fill all the fields in
the Main Form, first. Then I'll enable the subforms when all
prerequisite fields are filled. I haven't coded the 'enabling logic'.
I just have the 'disabling logic' in place.

I am really stuck here and could use some serious help.
Thanks.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
The detail section of a form goes completely blank if both these conditions
are met:
(a) There are no records to display, and
(b) No new records can be added.

Condition (a) might be because of the way the recordset if filtered.
Condition (b) might be because the form's AllowAdditions property is set to
No, or because the form is based on a read-only query.

A simpler solution might be to cancel the Before Insert event of the subform
if the main form is at a new record. It's this simple:

Private Sub Form_BeforeInsert(Cancel As Integer)
If Me.Parent.NewRecord Then
Cancel = True
MsgBox "Enter the main form record first."
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Susan Bricker" <sl*****@verizon.net> wrote in message
news:p0***************@news.uswest.net...
Hi. I have a Main form with a subform that has a subform. I have an
'Add Event' button on the Main Form that issues the following
instruction:

DoCmd.GoToRecord , , acNewRec

If the record being displayed BEFORE the 'Add Event' button is clicked
does not have data to be displayed (no associated linked records) then
when the 'new record' is displayed, the innermost subform looks just
fine (all the controls are there and they are empty).

However, if the record being displayed BEFORE the 'Add Event' button is
clicked does have data to be displayed (there are associated linked
records) then when the 'new record' is displayed, the innermost subform
does not show the empty controls at all.

Any ideas why?

Some additional information:
I have the imbedded subforms 'disabled' (enabled=false) when the new
record is displayed. I want to force the user to fill all the fields in
the Main Form, first. Then I'll enable the subforms when all
prerequisite fields are filled. I haven't coded the 'enabling logic'.
I just have the 'disabling logic' in place.

I am really stuck here and could use some serious help.

Nov 13 '05 #2

P: n/a
Allen,

Thank you, so much, for replying to my post. Your solutions sounds just
like what I want. I'll have to "rip" out some code but it certainly
seems much simpler. I'll get back to this post after I give it a try.
Thanks, again.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3

P: n/a
Allen,

I tried the Form_BeforeInsert( ) in the subform. It works as long as no
data has been entered in the Parent form. However, as soon as any data
is entered in the Parent form and the tab key is hit, something happens
(I don't know what) ... and then the subform is "not editable" so I
can't continue to test to make sure that the subform is only available
after all Parent fields are filled. It's as if the AllowAdditions and
AllowEdits properties for the subform have been set to
"Enabled=no/false".

I tried to trace it by setting a breakpoint in the AfterUpdate event of
a field in the Parent form. I hit the breakpoint and then it didn't
step through any more routines ... just went to "end" and the form was
then accessible again (I don't know the right terminology ... hope you
understand). So, it appears that I didn't hit any code that would have
changed the properties listed above.

Any ideas?

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #4

P: n/a
If you enter something into the main form, and then move the cursor into the
subform, Access saves the main form record, and so the main form is no
longer at a new record (i.e. it now has an existing record.)

If you want to prevent the focus moving into the subform until you check the
main form record is ready to save, use the BeforeUpdate event of the main
form to run the check, and cancel that event if the record is not ready to
save.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Susan Bricker" <sl*****@verizon.net> wrote in message
news:CC***************@news.uswest.net...
Allen,

I tried the Form_BeforeInsert( ) in the subform. It works as long as no
data has been entered in the Parent form. However, as soon as any data
is entered in the Parent form and the tab key is hit, something happens
(I don't know what) ... and then the subform is "not editable" so I
can't continue to test to make sure that the subform is only available
after all Parent fields are filled. It's as if the AllowAdditions and
AllowEdits properties for the subform have been set to
"Enabled=no/false".

I tried to trace it by setting a breakpoint in the AfterUpdate event of
a field in the Parent form. I hit the breakpoint and then it didn't
step through any more routines ... just went to "end" and the form was
then accessible again (I don't know the right terminology ... hope you
understand). So, it appears that I didn't hit any code that would have
changed the properties listed above.

Any ideas?

Regards,
SueB

Nov 13 '05 #5

P: n/a
Allen,

Thank you for your suggestions. I'll give it a try.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.