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

  • Thread starter Thread starter Bec_FS
  • Start date Start date
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?
 
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
 
Back
Top