473,401 Members | 2,139 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,401 software developers and data experts.

How to Iterate through all Controls with a Particular Tag

sueb
379 256MB
On a subform, I want to change Properties for a set for fields. All these fields have the same Tag, and when I click a button on the form, I want to interate through these fields and set their Visibility.

What's the syntax for addressing these fields? Sort of like:

Expand|Select|Wrap|Line Numbers
  1. for each field_on_the_form.tag = "whatever" do
  2.      field.visibility = true
  3. end for
Jun 29 '11 #1

✓ answered by Jerry Maiapu

Try this:

Create the cmd button on the subform and add the following to its on_click event.

Expand|Select|Wrap|Line Numbers
  1. Dim ctl As Control
  2. For Each ctl In Me.Controls
  3.     If ctl.Tag = “Input your tag value here” Then
  4. Ctl.Visible=True
  5.     End If
  6. Next ctl
Hope this helps...

Passing by

5 2568
Jerry Maiapu
259 100+
One question. Is the subform in datasheet or continous or form view.?
I don know if it is possible in datasheet but it could be acheived in the other two views.
Jun 30 '11 #2
sueb
379 256MB
Oh, yes, it's continuous. I realize this means that all instances will change at once, but that's okay.
Jun 30 '11 #3
Jerry Maiapu
259 100+
Try this:

Create the cmd button on the subform and add the following to its on_click event.

Expand|Select|Wrap|Line Numbers
  1. Dim ctl As Control
  2. For Each ctl In Me.Controls
  3.     If ctl.Tag = “Input your tag value here” Then
  4. Ctl.Visible=True
  5.     End If
  6. Next ctl
Hope this helps...

Passing by
Jun 30 '11 #4
sueb
379 256MB
Oh, thanks, Jerry! That's just what I needed!
Jun 30 '11 #5
ADezii
8,834 Expert 8TB
Expand|Select|Wrap|Line Numbers
  1. Dim ctl As Control
  2.  
  3. For Each ctl In Me.Controls
  4.   ctl.Visible = (ctl.Tag = "Input your tag value here")
  5. Next
Jun 30 '11 #6

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

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
0
by: bill mahoney | last post by:
I have access 2k and I have 2 tables. One is a 7X6 table representing a month with zeroes padding the fields where no day exist. For example February 2003 0 0 0 0 0 0 1 2 3 4 5 6 7 ...
3
by: CSDunn | last post by:
Hello, I have a situation with MS Access 2000 in which I need to display report data in spreadsheet orientation (much like a datasheet view for a form). If you think of the report in terms of what...
2
by: Cro | last post by:
Dear Access Developers, I am developing a form with 'default view' set to "continuous forms". I am suffering with a problem I can't yet see a solution too. Each record has many fields. Two...
1
by: RiesbeckP | last post by:
Hi All, I have a DB where there are customer numbers and a few other fields. I want to be able to pull all of the null records for a particular field as well as all the other customer numbers...
6
by: allyn44 | last post by:
HI--what I am trying to do is 2 things: 1. Open a form in either data entry mode or edit mode depending on what task the user is performing 2. Cancel events tied to fields on the form if I am in...
2
by: Neo | last post by:
typedef union { struct { UINT16 reserved : 14; UINT16 bank_no : 2; } bit; UINT16 word; } HSL_BANK_SELECT_T;
3
by: mrhicks | last post by:
Hello all, I have a question regarding efficeny and how to find the best approach when trying to find flag with in a structure of bit fields. I have several structures which look similar to ...
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
3
subashini Thiyagarajan
by: subashini Thiyagarajan | last post by:
<% Dim adoCon Dim rsDeleteEntry Dim strSQL Dim lngRecordNo lngRecordNo = CLng(Request.QueryString("ID")) lngRecordNo1 = CLng(Request.QueryString("ID"))
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
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.