Trying to copy data from subform to form called up from a button..

B

Bec_FS

Need some help:
I have a form called “frmSurveysMain†with a subform called
“frmVESSegmentsSubformâ€, and on that subform is a button that opens up
another form “frmCapturesâ€, if there was captures. I am trying to have it
copy the Primary key from the subform “frmVESSegmentsSubform†into the form
that opens up from the button, called “frmCapturesâ€. The linking field is
called VESId. I have used this code a number of times and it has always
worked for me, but it is not working now. Here is what I have…when the
“frmCaptures†is opened on the BeforeInsert Event I have this code:
VESId = Forms!frmVESSegmentsSubform.UniqueVESId . However, it is not
working…maybe because I am calling the data from a subform within
frmSurveysMain?
 
B

Beetle

maybe because I am calling the data from a subform within
frmSurveysMain?

Yes. To reference a control on a subform you need to use the following syntax;

Forms!MainFormName!SubformControlName.Form!NameOfControl

What you are actually referencing with SubformControlName is the
control (window) that holds the subform. It will usually, but not necessarily,
have the same name as the subform itself. In your case the syntax should be;

Forms!frmSurveysMain!frmVESSegmentsSubform.Form!UniqueVESId
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top