checkbox - tag problem

indesisiv

Access - What's that?
Local time
Today, 22:30
Joined
Jun 13, 2002
Messages
265
Hi guys,

Sorry to be having a stupid day today but...

I have a form with loads of chk boxes on it and a command button to update.

What i need it to do is when the command button is clicked it loops around all of the chkboxes and adds the tag into a variable for putting into a text box.


I know that it is going to need something like

Dim ctl As Control


For Each ctl In Forms!form1
tags = tags & "whatever control tag"
Next ctl


But i don't know how to just limit to text boxes and how to get the tag.

Any help is grately appreciated.

Thanks Steve
 
Steve,

I'm not following what you need precisely but perhaps this code will explain itself (note the TypeOf Statement) and you can adjust to your specific situation.
Code:
Dim ctl As Control
Dim strTags As String

For Each ctl In Me
    If TypeOf ctl Is CheckBox Then
        If ctl.Value = True Then
            strTags = strTags & ctl.Tag
        End If
    End If
Next ctl

Me.txtboxwithtags.Value = strTags
Regards,
Tim
 
Cheers Tim
Works like a charm
 

Users who are viewing this thread

Back
Top Bottom