Reloading a Subform when you close a second subform that adds data to the first Form (1 Viewer)

GHFLRLTD

New member
Local time
Today, 11:04
Joined
Dec 22, 2020
Messages
2
I use Access to track data regarding my Sugar Levels and to add comments regarding what has happened to my legs, ankles, and feet regarding the Neuropathy condition that Type 2 Diabetes creates as you age.

What I want to to do, after I fill in and close the blue form, to display the data as the next data on the Green Form.

How do I do this - the documentation from Microsoft makes this a major thing to do, and I can not seem to find out how to get it done. I use the 2016 version of Access.
 

Attachments

  • Access Screens.JPG
    Access Screens.JPG
    41.1 KB · Views: 90

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:04
Joined
Feb 28, 2001
Messages
27,003
Understand that everything you do in Access relates to "events." Access manages the actions like navigation and such. Filling in bound controls is also an Access function. Building the display is an Access duty. However, events allow you to define event "routines" to supplement normal actions. To make a form recognize new data, that is typically done with a Me.Requery action. You can issue a Me.Requery in the appropriate event routine if you can set up that event routine.


You might consider the "Activate" event, which applies to forms, not controls. It might make sense in this context. See the hyperlink for info about the Activate event or you can web-search for "Access form activate event".

If you leave one form because you close it, Deactivate events occur for that form before closure is complete. But Access doesn't leave you dangling after a CLOSE if another form is open. You automatically (Re)Activate the 1st form when you close the 2nd one. That might be what you want.

I'll just push in the general direction and let you think about it. I don't know your level of expertise and I don't know the structure of your DB so I'll stop here. If you need more help, ask. I or one of the other members will see what we can do.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:04
Joined
May 7, 2009
Messages
19,175
add code to "On Close" Event of "New Test" (code builder).

private sub form_close()
If syscmd(acSysCmdGetObjectState, acForm, "LatestTestFormNameHere") <> 0 Then
[Forms]![LatestTestFormNameHere].Requery
End If
end sub
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:04
Joined
Feb 28, 2001
Messages
27,003
ArnelGP's solution is also good. He's just using a different event.
 

Users who are viewing this thread

Top Bottom