Trying to group a set of controls within a Frame

S

scott56hannah

Hi,

I am using Access 2007 for this first time and I am trying to group a set of
controls (textbox, combo and listbox)....so that I can then enable that frame
or disable it in one statement.

I was able to do this in Excel forms, but I cannot seem to get the Frame
control to recognise the controls within it...the frame.enable works for the
frame but not the controls in it...

Any suggestions would be appreciated.

Thanks
Scott
 
L

Linq Adams via AccessMonster.com

The way you "group" controls for this kind of manipulation is to use the Tag
Property. In form Design View, select the control(s) then got to Properties -
Other and enter a value in the Tag Property. Don't get confused if you see a
***SmartTag*** Property! This is something else entirely!

For the purposes of this demo, we'll make the Tag Property

Marked

Enter this in the Tag Property box (without quotation marks.)

Also, for purposes of this demo, we'll change the Enabled Property of the
tagged controls to Enabled = False. You can, of course, use the code to set
any property that the particular control type has.

Then, in an appropriate event, use this code.

Dim ctrl As Control

For Each ctrl In Me.Controls
If ctrl.Tag = "Marked" Then
ctrl.Enabled = False
End If
Next

End Sub

Be sure that the controls that are tagged actually have the property you're
trying to change, or you'll get an error! For instance, tagging a label
control and then trying to change the Enabled property will error out,
because labels don't have an Enabled property.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top