Copy record specific field to form - from another form and subform (1 Viewer)

theinviter

Registered User.
Local time
Today, 15:45
Joined
Aug 14, 2014
Messages
168
Dear guys;
wanna help ;
i have a form " Response" having a button "update1" .
and opened form " Search1" and subform " MRN Query1"
so once the user click on update1 then " location code" get the vale form " MRN Query1" and past it in the new record in " Response"

i tried below code but not working.
Private Sub Command189_Click()
DoCmd.GoToRecord , , acNewRec
Me.Location_Code = Forms![Search1].[MRN Query1].Form![Location_Code]


End Sub
 

June7

AWF VIP
Local time
Today, 14:45
Joined
Mar 9, 2014
Messages
4,374
Sorry, what you are attempting makes no sense. If these datasets have relationship, there won't be any records in subform for a new record on main form.

Why would you even want to populate a main form record with data from subform?
 

theinviter

Registered User.
Local time
Today, 15:45
Joined
Aug 14, 2014
Messages
168
Sorry, what you are attempting makes no sense. If these datasets have relationship, there won't be any records in subform for a new record on main form.

Why would you even want to populate a main form record with data from subform?
what i want to copy the record in current subform , and upon button click open another form and paste the value.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:45
Joined
May 7, 2009
Messages
16,393
you can just insert it using sql statement.
 

June7

AWF VIP
Local time
Today, 14:45
Joined
Mar 9, 2014
Messages
4,374
Okay, I missed that the destination was form that called form/subform. I too would use SQL if need entire record but since you appear to need value of only one field, something simpler should be possible.

What does "not working" mean - error message, wrong result, nothing happens?
Is the subform container control, not the form itself, named [MRN Query1]?
Why not a combobox on Response to select location code?

So form Response opens form/subform. You select a record in subform then return to Response and click button? What you show should work.

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

Really should give controls more meaningful names than the Access defaults.
 

Users who are viewing this thread

Top Bottom