473,569 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GoToRecor d , , 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 3479
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_BeforeInse rt(Cancel As Integer)
If Me.Parent.NewRe cord 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*****@verizo n.net> wrote in message
news:p0******** *******@news.us west.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.GoToRecor d , , 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_BeforeInse rt( ) 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*****@verizo n.net> wrote in message
news:CC******** *******@news.us west.net...
Allen,

I tried the Form_BeforeInse rt( ) 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
2332
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 and subform have worked fine to date with the subform's RecordSource set to an underlying DB table. To extend the existing app, I need to add controls to the subform and set their Text values...
2
1747
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 forms. (Tables)Student has StudentID (PK) & an ApplicationID. And Application has ApplicationID as its primary key. With the main Form being the Student_Details form, I have a Button which loads...
9
2735
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 different lists depending on which option is selected in the main form. I thought all I had to do for the subform was create a query and set the criteria equal to the option group value in the main...
1
1632
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 to load subform2 contents based on settings on subform1. The problem is: Order of loading is: subform1 subform2
2
2165
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 it in the before update event. But then I started getting a "No Current Record" error. I wanted to see what err number was coming through, so I put a MsgBox in the subform's error event. But the...
7
12291
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 DeAssign the SourceObject when leaving the Tab, I'm thinking the Table will stay open otherwise ??? - Do I also need to use code to Assign the Child&Master Links, or can I just type the names into...
18
3593
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 service requests) with a CustomerID that is unique for each customer and is autofilled on the subform. Subform contains field called TicketID (which there could be multiple instances of and is not...
1
2184
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 filters. Whenever I open de MainForm I have no problems. The mainForm opens and show the subform in shape of subDatasheet. The problem is that the sub-subForm doenst load unless I click on the...
3
2491
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 quad comboboxes based on the look up tables(ex tblCounty,tblTownship and tblQuad). When I run the subform alone, it works fine but when I put inside my main form it asks me to enter !! . This is...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.