Subform to requery Main form field (1 Viewer)

naobao

Registered User.
Local time
Today, 03:51
Joined
Feb 13, 2014
Messages
76
Hi,


How to requery "B"after entry a new record in "A"
 

Attachments

  • 123.jpg
    123.jpg
    53.5 KB · Views: 65

theDBguy

I’m here to help
Staff member
Local time
Today, 03:51
Joined
Oct 29, 2018
Messages
21,467
Hi. It's not obvious from the image, but is form B unbound?
 

naobao

Registered User.
Local time
Today, 03:51
Joined
Feb 13, 2014
Messages
76
"A" field is in subform, "B" field is in main form
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:51
Joined
Oct 29, 2018
Messages
21,467
"A" field is in subform, "B" field is in main form
That didn't really answer my question; but if it's a true form/subform setup, did you have the correct fields in the Master/Child Linked Fields properties? If not, then I guess what you're asking is how to refresh the data. If so, you could try using the Requery command, maybe in the AfterUpdate event of the textbox on the main form.
 

naobao

Registered User.
Local time
Today, 03:51
Joined
Feb 13, 2014
Messages
76
it not work use in subform field AfterUpdate event...
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:51
Joined
Oct 29, 2018
Messages
21,467
it not work use in subform field AfterUpdate event...
Hi. Sorry to hear that. Unfortunately, I can't tell you why or what else to try since I have no idea what your database really looks like. You didn't tell us if the form is bound or if the subform is properly linked to the main form. I'm not even sure if you're expecting to see the data you entered on the main form to show up in the subform. Are you able to post a sample db?
 

naobao

Registered User.
Local time
Today, 03:51
Joined
Feb 13, 2014
Messages
76
I will prepare the sample file for you
 

naobao

Registered User.
Local time
Today, 03:51
Joined
Feb 13, 2014
Messages
76
Hi theDBguy


Please check the attached file
 

Attachments

  • sample.accdb
    768 KB · Views: 34

theDBguy

I’m here to help
Staff member
Local time
Today, 03:51
Joined
Oct 29, 2018
Messages
21,467
Hi theDBguy

Please check the attached file
Hi. I downloaded your sample file, but I'm getting an error because I don't have the same language pack installed as you. In any case, try using Me.Recalc in the button code instead of Me.Requery. Hope it helps...
 

naobao

Registered User.
Local time
Today, 03:51
Joined
Feb 13, 2014
Messages
76
Me.Recalc same no use!

I just only want to know, after update the subfom field, how to requery the main form field?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:51
Joined
Oct 29, 2018
Messages
21,467
Me.Recalc same no use!

I just only want to know, after update the subfom field, how to requery the main form field?
Hi. To requery, you use Requery. To recalculate, you use Recalc. In the demo you posted for me, you don't have anything on the main form. They are all subforms. The two smaller subforms are read only, so I imagine you want to update those because you can only update the bigger subform. I created a test file and tried using Recalc, and it worked for me. Since I can't really use your demo file, I can't test it.
 

naobao

Registered User.
Local time
Today, 03:51
Joined
Feb 13, 2014
Messages
76
please check the pic
 

Attachments

  • 111.jpg
    111.jpg
    68.5 KB · Views: 55

theDBguy

I’m here to help
Staff member
Local time
Today, 03:51
Joined
Oct 29, 2018
Messages
21,467

Attachments

  • demo.zip
    23.6 KB · Views: 50

naobao

Registered User.
Local time
Today, 03:51
Joined
Feb 13, 2014
Messages
76
Sorry to make you confused...
I mean not use the button,
is the big subform field after update,
the two small subform can auto requery
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:51
Joined
Oct 29, 2018
Messages
21,467
Sorry to make you confused...
I mean not use the button,
is the big subform field after update,
the two small subform can auto requery
Hi. Either way, I still used Recalc. Check out the attached modified demo. You don't have to click the button, although I left it there.
 

Attachments

  • demo.zip
    26.3 KB · Views: 50

Users who are viewing this thread

Top Bottom