That seems a bit more efficient than looping through each control's properties. I'll give it a try.
I was hoping to avoid having to have a conditional expression with all the types of controls for which the Enabled property exists. It could get rather long with textbox, combo box, list box, command button, etc. --- In AccessDevelopers@yahoogroups.com, "Tom Oakes" <[EMAIL PROTECTED]> wrote: > Hi Larry, > > You can use TypeOf to determine what type of control you're dealing > with. You'd just need to expand the routine below to check for the > differenct control types that can be disabled. > > > Sub DisableForm(blnEnable As Boolean, frm As Form) > > Dim ctl As Control > > For Each ctl In frm.Controls > If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Then > ctl.Enabled = blnEnable > End If > Next > > End Sub > > Hope that helps, > > Tom Oakes > [EMAIL PROTECTED] > > --- In AccessDevelopers@yahoogroups.com, "stcuser" > <[EMAIL PROTECTED]> wrote: > > I'd like to know if there is a way in VBA to determine whether or > not > a > > given property exists for a given control on a form. I have a form > > where all controls initially have the Enabled property as No, and > want > > to set, via VBA code, the Enabled property to Yes for all the > controls > > for which the Enabled property is valid. (Not all controls on a > form > > have the Enabled property.) I know I can loop through a control's > > collection of properties looking for the name "Enabled", but with a > few > > dozen control on the form, that's got to be inefficient. I'd like > to > > loop through the controls and just see if it has the Enabled > property > > without having to loop through all the control's properties. ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/q7folB/TM --------------------------------------------------------------------~-> Please zip all files prior to uploading to Files section. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AccessDevelopers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/