Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 9th, 2005, 07:33 AM
Registered User
 
Join Date: Feb 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Code transfer to form!field

I am preparing a form to report on all new suggestions entered into the system by month; ie the number entered in Jan, Feb, Mar, etc.

The months are displayed in teh form as 12 fields named new_1, new_2, new_3 etc.

In the code I have obtained the numbers entered by month and stored them in an array LNew (12) as Long.

I now want to use a loop to transfer the results to the form;

eg

For i = 0 to 11

x= i + 1

Me!new_ x = Lnew (i)

Next

I am having difficulty setting up the reference to Me!new_x to change each loop to place the infotmaion on the right month field. How do I do this.

Thanks


 
Old July 11th, 2005, 09:51 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Try Me("new_" & 1).text or Me("new_" & 1).value (I forget which).

If that doesn't work, you can (for each new iteration of the For loop) loop through all of the controls on the form through its Controls collection, checking their .Name, and when you find the one that matches what you're looking for, set a reference to that control.
If you set the variable type of the object that will hold that reference as Dim x As Textbox, then that reference will have the necessary properties to handle the manipulation you are attempting in the For loop.





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to transfer value from one form to another cancertropica C# 2005 1 July 27th, 2008 02:42 PM
Transfer control value from a Form to Subform jimmy0305 Access VBA 1 March 16th, 2006 03:13 PM
Transfer of Form Values in Javascript pkdev Javascript How-To 3 June 21st, 2004 05:15 AM
how do you transfer a field value in the link doranaz Classic ASP Databases 2 December 25th, 2003 10:38 AM
Form data won't transfer to next screen wjenkins Javascript How-To 2 September 8th, 2003 10:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.