Solved Subform not showing some information (1 Viewer)

spa856

New member
Local time
Today, 22:08
Joined
Apr 21, 2023
Messages
26
Hello, I have the following form.
1693478908386.png


My issue is the following:
when opening the form, the fields of the subform do not show their value even though they are filled in. If I enter any value in any field and press F5 it then shows everything.
why?
 

Ranman256

Well-known member
Local time
Today, 16:08
Joined
Apr 9, 2015
Messages
4,337
do you have the subform properties bound:
LINK MASTER ID =txtID
LINK CHILD ID =txtID
to the master form ID field?

or

the subform query can have the ID as criteria:
select * from tChildTbl where [id] = forms!fMasterFrm!txtID
 

spa856

New member
Local time
Today, 22:08
Joined
Apr 21, 2023
Messages
26
The second option.
The query match for IDs...and if I run the query It shows the result...the subform shows only After an update and click on F5
 

mike60smart

Registered User.
Local time
Today, 21:08
Joined
Aug 6, 2017
Messages
1,913
The second option.
The query match for IDs...and if I run the query It shows the result...the subform shows only After an update and click on F5
Use the first option
 

spa856

New member
Local time
Today, 22:08
Joined
Apr 21, 2023
Messages
26
I cannot use the first option.
The relationship is one to one.
Can I share the DB?
 

Mike Krailo

Well-known member
Local time
Today, 16:08
Joined
Mar 28, 2020
Messages
1,044
I cannot use the first option.
The relationship is one to one.
Can I share the DB?
Very rare to have a 1 to 1 relationship. Could you explain the reason for it? Also, just compact and repair to reduce the size, and then zip it up and attach the file to your next post.
 

spa856

New member
Local time
Today, 22:08
Joined
Apr 21, 2023
Messages
26
Because for each store I can only have one invoice
at the end of the year, I archive the record (create a key to make it unique) and empty the fields of the invoice so that I can use it again the following year.

Not the best solution, I know but I didn't know how to get the application to understand to create a new invoice or manage the invoice already in progress based on what the user should do
 

Mike Krailo

Well-known member
Local time
Today, 16:08
Joined
Mar 28, 2020
Messages
1,044
Trying to understand why you have the two queries linked the way do now by master: ID_PV and child: ID_PV. The reason you don't see any records in the subform is because there are very few matching records in the subform query containing a matching ID_PV. So I would say, everything is working just fine.

Only 10 out of 389 of the records show a matching ID_ISTANZA, indicating that the master child links indeed work just not correct.
1693829711454.png

And from the other query in the sub form: Notice that there are only 10 matching records using ID_PV as the child link. If you change it to ID_PV_T_PUNTO_VENDITA for the child link, I'm guessing you will get more matches. Try it and see. Wait, I tried that and got an error "The expression On Current you entered as the event property setting produced the following error: Object or class does not support the set of events." So you need to populate all of the ID_PV fields that are not currently populated or explain in more detail what is going on with this very strange 1:1 relationship that has only 10 records populated with ID_PV.

I just commented out the Me.Repaint line of code in your current event of the sub form and it works using the ID_PV_T_PUNTO_VENDITA as the child link. See if that works for you.
1693830097655.png

This works for me:
1693830888143.png
 

spa856

New member
Local time
Today, 22:08
Joined
Apr 21, 2023
Messages
26
I understand and thank you.
I wrong the match key...now it works.
 

Mike Krailo

Well-known member
Local time
Today, 16:08
Joined
Mar 28, 2020
Messages
1,044
You're welcome, mark as solved and hit that like button. Just an afterthought, you should probably remove that ID_PV from the sub form record source as I don't think that is needed. I'm guessing those 10 records were actually created by forcing the sub form to update and it saved those ID's during your troubleshooting.
 
Last edited:

Users who are viewing this thread

Top Bottom