Populate Form2 with Form1's Subform data

SAGulick

Registered User.
Local time
Today, 14:25
Joined
Feb 8, 2006
Messages
18
I have a form where a different form opens up when a user clicks a certain button. What I’m trying to do is assign a field value from form1's subform to a field on form2 and it’s telling me "Run-time error ‘-2147352567 (80020009)’, You can’t assign a value to this object." I'm new to VBA, but think I'm on the right track. Could someone please tell me what I’m doing wrong.

The code I'm using is: Me.txtStoreNo = [Forms]![frmCDRData4REF]![sfrmCDRData4REF].Form!txtStoreNo
 
Welcome to Access World Forums! If you are using acXP+ then why not just pass the data in the OpenArgs argument of the OpenForm command? In what event of which form did you put that code?
 
I put it on the On Click event from Form1. I'm not sure what you mean by "OpenArgs"? Yep, I'm a newbie.

Thx
 
I might want to add that I don't want to duplicate a StoreNo if it already exists, in the table.
 
Your code would probably work as is if you put it in the OnLoad event of Form2. I would still use the OpenArgs argument. Review OpenForm in VBA help and post back here if you need more assistance.
 

Users who are viewing this thread

Back
Top Bottom