472,338 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,338 software developers and data experts.

Subform not loading (I think)

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
5 3337
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Joseph J. Egan | last post by:
I am extending an existing Access/VBA app and need to update a subform displayed in continuous view within a containing form. The existing form...
2
by: nic | last post by:
Hi I am currently having problems getting two forms to behave the way I want. I have two tables Student and Application, and their respective...
9
by: PC Datasheet | last post by:
I'm stuck on something that seems should be easy and I need some help. My main form has an option group with five options. My subform chooses from...
1
by: sasan3 | last post by:
I have a main form "topform" contaning "subform1" and "subform2" The goal is: I need to requery subform2 on CURRENT event of subform1, and I need...
2
by: Bill Stock | last post by:
I have a subform which is causing a 3314 (Field can't contain a null value because required is set to True) error. I solved this problem by trapping...
7
by: ApexData | last post by:
I am using the following code in my TabControl to manage subform loads. The code assigns the subForms SourceObject. - Do I also need code to...
18
by: Robert Jacobs | last post by:
Please advise... I currently have a Mainform (Customers) and a Subform (Service Requests) with a one to many relationship (one customer, many...
1
by: maffonso | last post by:
Hi people, My main form has a subform nested with another subform, both subs work as a subDatasheet. Indeed I keep the mainForm just to put some...
3
by: AccessBeetle | last post by:
I have a table called tblLocationInfo which has field like I have a form which has a subform and this subform has all these county, township and...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.