Avatar of wlwebb
wlwebb
Flag for United States of America asked on

Access - VB to copy info from a Main Form Textbox it's SubForm Textbox using Variable Name

Hello All

Have a form with several Subforms.  I have been using variables to cycle through copying info within forms but this one is a variable that copies info from one form to several  subforms.  

I know I can use Me("xxxx" & i) = Me("xxx" & i+1) within a form but can you do that from a Form to a Subform?

I have tried this and it does not like my Syntax.    I get Run-Time Error '2465' Can't fine the field '|' referred to in your expression???????


My code is
                ["sfrm_ctl_Addr" & x].Form![txtStreetName] = Me("txtStreet" & (Format(x, "00")))
Microsoft Access

Avatar of undefined
Last Comment
wlwebb

8/22/2022 - Mon
mbizup

Have you tried this?


Me.SubformControlName.Form("xxxx" & i) = Me("xxx" & i+1)
ASKER CERTIFIED SOLUTION
mbizup

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
wlwebb

ASKER
Hmmmm... no!  Give me a minute.........
wlwebb

ASKER
PERRRRFFFEEEECCCTTTTT!!!!!!!!  Thanks Mbiz!!!!!!!!!  I Really appreciate it.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes