473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

How can I dynamically select the form field to assign to a variable in VBA

Expand|Select|Wrap|Line Numbers
  1. Dim formItemS As String, ParmString As String
  2. ParmString = "TelephoneNum1"
  3.  
  4. formItemS = Forms!frmMacRequestsInputAdd!TelephoneNum1
Debug Results
Expand|Select|Wrap|Line Numbers
  1. ? formItemS
  2. 5555555555
I want to do this and get 5555555555
Expand|Select|Wrap|Line Numbers
  1. formItemS = Forms!frmMacRequestsInputAdd!ParmString
I need to know how to dynamicaly input which field to move to formItems.
Sep 9 '10 #1

✓ answered by MikeTheBike

Hi

Maybe somthing like this
Expand|Select|Wrap|Line Numbers
  1. Dim formItemS As String, ParmString As String
  2. ParmString = "TelephoneNum1"
  3.  
  4. formItemS = Forms("frmMacRequestsInputAdd").Controls(ParmString)
  5.  
  6.  
  7. MsgBox formItemS
??

MTB

3 3671
MikeTheBike
639 Expert 512MB
Hi

Maybe somthing like this
Expand|Select|Wrap|Line Numbers
  1. Dim formItemS As String, ParmString As String
  2. ParmString = "TelephoneNum1"
  3.  
  4. formItemS = Forms("frmMacRequestsInputAdd").Controls(ParmString)
  5.  
  6.  
  7. MsgBox formItemS
??

MTB
Sep 10 '10 #2
NeoPa
32,556 Expert Mod 16PB
Quite right. An alternative for line #4 would be :
Expand|Select|Wrap|Line Numbers
  1. formItemS = Forms!frmMacRequestsInputAdd.Controls(ParmString)
Sep 10 '10 #3
That was exactly what I needed. I knew it was something relatively simple.

Thank you very much!!
Sep 10 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: JDS | last post by:
Hi, all. I'd like to do the following, preferably *without* resorting to JavaScript: I have a long, dynamically-generated form questionnaire. Not all of the form fields are dynamically...
1
by: Keiron Waites | last post by:
Hi, I have two select fields with the multiple attribute so you can see all options. When a user clicks on one form, I would like to deselect anything from the other form. Is there a way to do...
1
by: Randell D. | last post by:
HELP! I am determined to stick with this... I'm getting there... for those who haven't read my earlier posts, I'm createing what should be a simple function that I can call to check that...
3
by: Shabam | last post by:
I know that dotnet allows for form field validation. However I'm looking to customize the error message display and am wondering if it's possible to do what I need. Example: Suppose in a...
3
by: Chris | last post by:
Before I started to create table, etc to track unique form field record number assigments I thought I'd check to see if there is now a better way to do this in .NET. I have a parent form (table)...
14
by: Paul | last post by:
I want to set the page title and/or a form hidden field programatically through ASP.Net. I do not want to use something like... <% sTitle ="My Title" %> <html><title><%=sTitle%></title>..... ...
3
by: shingabiss | last post by:
Is there a way to use PHP to address the HTML DOM like is done in Javascript? For example, in Javascript: formname.formfield.value = variablename; Can PHP operate in the same way?
9
by: Brett_A | last post by:
I have a form where the first field is a dynamic drop-down that pulls from a db (Access). The fields associated with the query are task_id, task_name and task_rate. The field has the value of...
4
Haitashi
by: Haitashi | last post by:
Snippet: <form> <select name="secCode" id="secCode"> <cfloop query="Request.qSecCodes"> <option value="#Request.qSecCodes.org_name#" <cfif (Request.qSecCodes.org_code EQ...
25
by: ramprat | last post by:
Hi All, I'm essentially trying to extract a value from the pre_05_growth_factor column of my traffic table and assign it to a variable to be used later. Does anyone know why the code below...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.