Solved Subform goes blank when add new record is pressed. (1 Viewer)

Ashisht76

Member
Local time
Today, 18:20
Joined
Jan 31, 2022
Messages
44
1) I have a form and it has subform in it,
2) When old records are viewed it works fine.
3) The moment add new records is pressed the subform goes non-responsive (shows nothing in it).
4) Tried everything,
A) Removed all my codes from both main form and subform,
B) Checked all codes to see if any other code is interfering,
C) Tried all online help which said to change "Data Entry property" to No and also tried in Yes, "Allow additions" property to Yes and also tried No as well, also refresh the subform "on load" event, have put Row source property of subform "On Open" event and few more things.

Nothing seems to work, Please advise if there is something is have missed...
 

June7

AWF VIP
Local time
Today, 04:50
Joined
Mar 9, 2014
Messages
5,425
What is the subform's RecordSource?

If you want to provide for analysis, follow instructions at bottom of my post.
 
Last edited:

Mike Krailo

Well-known member
Local time
Today, 08:50
Joined
Mar 28, 2020
Messages
1,030
Did you try stepping through the code to analyze what it's doing in detail. You might also try importing all objects into a new database to rule out corruption of some kind.
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 12:50
Joined
Sep 21, 2011
Messages
14,052
1) I have a form and it has subform in it,
2) When old records are viewed it works fine.
3) The moment add new records is pressed the subform goes non-responsive (shows nothing in it).
4) Tried everything,
A) Removed all my codes from both main form and subform,
B) Checked all codes to see if any other code is interfering,
C) Tried all online help which said to change "Data Entry property" to No and also tried in Yes, "Allow additions" property to Yes and also tried No as well, also refresh the subform "on load" event, have put Row source property of subform "On Open" event and few more things.

Nothing seems to work, Please advise if there is something is have missed...
Well if the subform is linked to the mainform (and they generally are? ), then there is nothing to show, surely?
 

Ashisht76

Member
Local time
Today, 18:20
Joined
Jan 31, 2022
Messages
44
Well if the subform is linked to the mainform (and they generally are? ), then there is nothing to show, surely?
I made link while i created both, besides if there is connection issue than how the records that are already entered are showing but only when new records is pressed its getting disappear!
 

Mike Krailo

Well-known member
Local time
Today, 08:50
Joined
Mar 28, 2020
Messages
1,030
Are you talking about the built in new records icon at the bottom of the form or a button you created on the form?
 

Ashisht76

Member
Local time
Today, 18:20
Joined
Jan 31, 2022
Messages
44
The issue is in "FrmGreyFabricOrder" Please have a look at it.
 

Attachments

  • Radio1.zip
    68.8 KB · Views: 177

Ashisht76

Member
Local time
Today, 18:20
Joined
Jan 31, 2022
Messages
44
Are you talking about the built in new records icon at the bottom of the form or a button you created on the form?
yes, but same problem remains in default new order button at the bottom.
 
Last edited:

SHANEMAC51

Active member
Local time
Today, 15:50
Joined
Jan 28, 2022
Messages
310
Я сделал ссылку, пока я создавал оба, кроме того, если есть проблема с подключением, то как отображаются записи, которые уже введены, но только когда новые записи нажаты, они исчезают!
check - возможно, что записи в подчиненной таблице добавляются, но поле связи с основной таблицей в них не заполняется

см. таблицу 2 непосредственно

check - it is possible that records in the subordinate table are being added, but the field of connection with the main table is not filled in in them

see table 2 directly
 
Last edited:

June7

AWF VIP
Local time
Today, 04:50
Joined
Mar 9, 2014
Messages
5,425
I can't open db with Access 2010.

Shanemac51, why are your posts in Russian or Greek or whatever?
 

Mike Krailo

Well-known member
Local time
Today, 08:50
Joined
Mar 28, 2020
Messages
1,030
It just looks like allowadditions is not true on the subform when you go to a new record on the main form. You have to turn them back on when the ADD button is pressed.

Code:
Private Sub BtnAddNew_Click()
    Me!SubFrm_SubTblGreyFabricOrder.Form.AllowAdditions = True
    DoCmd.GoToRecord , , acNewRec
End Sub
 
Last edited:

June7

AWF VIP
Local time
Today, 04:50
Joined
Mar 9, 2014
Messages
5,425
I know I could but why would I, what is my incentive to take that time? This is an English site. Poster should do the translation in English. Shanemac51 is doing a lot of posts in Russian.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:50
Joined
May 7, 2009
Messages
19,175
of course the subform will go blank, you have Link Master/Child fields on your subform (GreyOrderID).
when you are in New record of main form, the GreyOrderID of the subform is not yet available.
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:50
Joined
Sep 21, 2011
Messages
14,052
of course the subform will go blank, you have Link Master/Child fields on your subform (GreyOrderID).
when you are in New record of main form, the GreyOrderID of the subform is not yet available.
That was my point exactly? :(
 

Ashisht76

Member
Local time
Today, 18:20
Joined
Jan 31, 2022
Messages
44
check - возможно, что записи в подчиненной таблице добавляются, но поле связи с основной таблицей в них не заполняется

см. таблицу 2 непосредственно

check - it is possible that records in the subordinate table are being added, but the field of connection with the main table is not filled in in them

see table 2 directly
No nothing in table is added, besides the issue is that nothing appears in subform that means i cant enter any data. Please check the database is attached.

В таблицу ничего не добавляется, кроме того, проблема в том, что в подчиненной форме ничего не появляется, что означает, что я не могу ввести какие-либо данные. Пожалуйста, проверьте, что база данных прикреплена.
 

SHANEMAC51

Active member
Local time
Today, 15:50
Joined
Jan 28, 2022
Messages
310
I created a duplicate form ---everything works
, you overreacted with the code canceling the data correction

also, you are trying to do something in the form event AFTER the CHANGE, although nothing can be done in the form anymore - it is disabled, you cannot access the form control
 

Mike Krailo

Well-known member
Local time
Today, 08:50
Joined
Mar 28, 2020
Messages
1,030
In post #12, I gave you the exact reason why it wasn't working. Also, could you update the title of this thread to correct the spelling from Subfrom to Subform. That makes it easier to search for later.
 
Last edited:

Ashisht76

Member
Local time
Today, 18:20
Joined
Jan 31, 2022
Messages
44

SHANEMAC51 and Mike Krailo, Thanks for your reply also typo in subject is corrected, sorry for that.​

I understand now that there is allow edit property has issue and its obvious because of the coding. . . I will try to find the culprit code by elimination process and will revert to close this thread.​

 
Last edited:

Users who are viewing this thread

Top Bottom