Re: Assigning more than one tag to tag property



Okay, each control may or may not have a series of tags, so it's the Tag for
each control on which the Split function needs to work. Then, once you've
split each tag, you need to loop through the tags and see whether the
desired tag exists in that list.


Dim ctl As Control
Dim strMyTag() As String
Dim intI As Integer

For Each ctl In Me
If Len(ctl.Tag & vbNullString) > 0 Then
strMyTag = Split(ctl.Tag, ";")
For intI = 0 To UBound(strMyTag)
If strMyTag(intl) = "**" Then
If IsNull(Me.DailyDate) Then
ctl.Enabled = False
Else
ctl.Enabled = True
End If
End If
Next intl
End If
Next
Set ctl = Nothing

I do agree with David that a more robust way makes better sense. (In other
words, store the data about which control(s) belong to which group in a
table)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


<HeislerKurt@xxxxxxxxx> wrote in message
news:1183680376.601023.318000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Use the Split function to divide the tag into the individual component
elements.

Okay. Been reading up the Split function in VBA and what I found isn't
very clear to me. What I have so far gives me a "subscript out of
range error."

Below is the code in the OnCurrent event of a subform. The tag
property I'm trying to extract is the first one in the array: "**"

###

Dim ctl As Control
Dim strMyTag() As String

strMyTag = Split(Me.Tag, ";")

For Each ctl In Me
If strMyTag(0) = "**" Then
If IsNull(Me.DailyDate) Then
ctl.Enabled = False
Else
ctl.Enabled = True
End If
End If
Next
Set ctl = Nothing

###

I see that some people also define the upper and lower bounds of the
tag, as in ...

Dim intI As Integer

strMyTag = Split(Me.Tag, ";")
For intI = 0 To UBound(strMyTag)
Next intI

... but it's not clear to me what this is supposed to do, or if it's
even relevent in my situation.

Kurt

On Jul 5, 6:56 pm, "Douglas J. Steele"
<NOSPAM_djsteele@xxxxxxxxxxxxxxxxx> wrote:
Use the Split function to divide the tag into the individual component
elements.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)

<HeislerK...@xxxxxxxxx> wrote in message

news:1183667760.478968.286760@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



It it possible to assign more than one tag to a control's tag
property, so that you can assign it to multiple groups?

I tried separating tags by semicolons or commas but that seemed to
render each tag obsolete.

Kurt- Hide quoted text -

- Show quoted text -




.



Relevant Pages

  • Re: Assigning more than one tag to tag property
    ... so by parsing out multiple tag properties the code ... controls with a tag property of "carryover". ... Dim rst As DAO.Recordset ... Dim ctl As Control ...
    (microsoft.public.access.forms)
  • Re: Assigning more than one tag to tag property
    ... Dim ctl As Control ... Dim strMyTag() As String ... tag, as in ... ... Dim intI As Integer ...
    (microsoft.public.access.forms)
  • RE: Select Case help
    ... Tag values, just type VVII, for example. ... > I'll try to use the name property of the control. ... >> For Each ctl In Me.Controls ...
    (microsoft.public.access.forms)
  • Re: Controls accessing outside tags
    ... Dim a as htmlControl ... For each frmCtrl as Control in a.Controls ... the onLoad event to the myBody tag - it is there, ... Would this apply also to aspx controls ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: User level access to data entry
    ... You only need to tag the control you want to unlock. ... Dim ctl As Control ... we can allow a read only user to edit one field in a particular form. ...
    (microsoft.public.access.formscoding)