Grab Record From Another Frm?

dalski

New member
Local time
Today, 02:54
Joined
Jan 5, 2025
Messages
20
Off a previous topic which I thought I understood but don't - how can I grab a record from the sourcefrm & put it in the newHomefrm?

I want to use a buffer variable & feed the ID to the newHomefrm without opening the form & using openingArguments. The sourcefrm will already be open. I want to click btn in NewHome, then go to the already open SourceF, click on something then the selected record from SourceF will be put into the GrabbedID record in the NewHomefrm.

Screenshot_1.jpg
 

Attachments

Last edited:
You probably need to explain in detail what you want to do. There are lots of ways to pull information off of a popup form. But what you show does not make much sense.
Normally the form you want to grab from is a Popup.
I do it the same way every time.

1. On my pop up I have an OK and Cancel button.
OK hides the popup
Cancel closes the popup.
2. I open the PopUp using ACDIALOG in the DOCMD.OPENFORM this stops code execution in calling form until the pop up hides or closes.
3. Once hidden or closed the code resumes in calling form.
Check to see if the form is hidden then grab the value and close the form
If closed do nothing.

Example
There are other ways too. You can trap a popup form event in the calling form and read the value.
You will see some examples here.
 

Attachments

What the demo is trying to show is that the same code is reusable by the many different pop ups and many different controls.
 
Thanks @MajP, too complicated for me to grasp that demo & our previous topic I don't want to have to filter selections from the source each time. I'll have the SourceFrm open each time at the area I want. I select the item I want from the Sourcefrm & it puts it to the NewHomefrm.

A variable inside the SourceFrm/ Global Module (ideally would not be global but limited scope to the calling NewHomeFrm) which will hold the value of the selected ID from the the SourceFrm then create a new record in the NewHomeFrm & put the ID there. Like our previous topic but I don't want to have to open the form with opening arguments. I've tried simplifying so i can see how it works here. Just way too much for me to comprehend in the previous topic.
 
Last edited:
Here is a simple hard-wired solution. Not something I would do, but will work
Code:
Private Sub cmdSend_Click()
  If CurrentProject.AllForms("newhomef").IsLoaded Then
    If Not IsNull(Me.ID) Then
      MsgBox "Pushing selected ID, " & Me.ID & ", to New Home", vbInformation, "Push ID"
      Forms!newhomef.grabbedID = Me.ID
      Forms!newhomef.Refresh
    End If
  Else
    MsgBox "New Home form not loaded", vbInformation, "Not Loaded"
  End If
 
End Sub
Capture.PNG
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom