Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2012-12-27
4
Medium Priority
?
365 Views
Last Modified: 2012-12-27
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")))
0
Comment
Question by:wlwebb
  • 2
  • 2
4 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 38724869
Have you tried this?


Me.SubformControlName.Form("xxxx" & i) = Me("xxx" & i+1)
0
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 38724873
Maybe this...

                Me.Controls("sfrm_ctl_Addr" & x).Form![txtStreetName] = Me("txtStreet" & (Format(x, "00")))

Open in new window

0
 

Author Comment

by:wlwebb
ID: 38724876
Hmmmm... no!  Give me a minute.........
0
 

Author Closing Comment

by:wlwebb
ID: 38724965
PERRRRFFFEEEECCCTTTTT!!!!!!!!  Thanks Mbiz!!!!!!!!!  I Really appreciate it.
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question