Selasa, 25 November 2014

Re: [MS_AccessPros] Add Multiple tags to a for each statement

 

Duane,

Thank You. I have two tags called Audit and Emissions. Do I put a comma between the tags?

 
Jim Wagner


On Tuesday, November 25, 2014 1:09 PM, "Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:


 
Jim,
 
You can place multiple values in the tag property and then use code like:
 
For Each ctrl In Me.Detail.Controls
       ctrl.Visible = (Instr(Ctrl.Tag,"Audit") = 0)
Next ctrl
 
When I want greater control, I will pair up attributes and values then use this function:
 
Public Function ParseAttrib(strText As String, _
        strAttrib As String, _
        strDelimiter As String)
'---------------------------------------------------------
' Procedure : ParseAttrib
' Author    : Duane Hookom
' Date      : 10/1/2010
' Purpose   : Pull a single value from a multi-value string
'             the strText must use = to match an attribute with its value
'
' Samples
' --------------------------------------------------------
' ParseAttrib("color=red;Age=50;Dog=False","Color",";")=red
' ParseAttrib("color=red;Age=50;Dog=False","dog",";")=False
'---------------------------------------------------------
    Dim arText() As String
    Dim intI As Integer
    On Error GoTo ParseAttrib_Error
    arText() = Split(strText, strDelimiter)
    For intI = 0 To UBound(arText)
        If Split(arText(intI), "=")(0) = strAttrib Then
            ParseAttrib = Split(arText(intI), "=")(1)
        End If
    Next
    On Error GoTo 0
    Exit Function
ParseAttrib_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ParseAttrib of Module basParseText"
End Function
 
Duane Hookom MVP
MS Access
 

To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Tue, 25 Nov 2014 20:01:43 +0000
Subject: [MS_AccessPros] Add Multiple tags to a for each statement



Hello all,

I have multiple tags that I would like to include in  a procedure. How would I add a second tag to the following code?
do I have to write two for each statements?

Thank you for your help in advance

For Each ctrl In Me.Detail.Controls
    If ctrl.Tag = "Audit" Then
        ctrl.Visible = False
    End If
Next ctrl
 
Jim Wagner




__._,_.___

Posted by: Jim Wagner <luvmymelody@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

.

__,_._,___

Tidak ada komentar:

Posting Komentar