Solved OnClick Event to copy data in field (Main Form) to field in subform? (1 Viewer)

hbrehmer

Member
Local time
Today, 01:12
Joined
Jan 10, 2020
Messages
78
Hey All,

I am having trouble with my code on a click button on a subform. I want a click event on my subform to copy data from main form to field on subform. A little background: field on main form is a Key Field, field on subform is just the linking field between the two tables. (Main form data is the One Table, subform is the Many Table) So I want to create my one table and then assign the many table with the Key field #. I have a click button on the subform which is a continuous form and the click event copies the field from the main form. What am I missing in this code?

Private Sub Command12_Click()
Me.[VSHIPID] = [frmVenShipEntry].[Form]![VSHIPID]
End Sub

I keep getting an error message when I click my button on the subform. Run-time error '2465': Microsoft Access can't find the field '|1' referred to in your expression. ?
 

hbrehmer

Member
Local time
Today, 01:12
Joined
Jan 10, 2020
Messages
78
Never Mind!!! I am so stupid! I had my code written wrong. For those that need the reminder:

Me.VSHIPID = [Forms]![frmVendShipEntry]![VSHIPID]

Thanks Everyone!
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:12
Joined
Sep 21, 2011
Messages
14,232
Code:
Me.VSHIPID  = Me.Parent.VSHIPID
?
 

Users who are viewing this thread

Top Bottom