By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Need help in VBA code of looping through controls

100+
P: 176
Hi All.
I'm trying to delete conditions from all the controls in my form via VBA command. This code doesn't work though:

Expand|Select|Wrap|Line Numbers
  1. Dim frm As Form
  2. Dim myControl As Control
  3.  
  4. Set frm = Forms!Customers
  5.  
  6. For Each myControl In frm.Controls  'I also tried myControl in frm
  7.       myControl.FormatConditions.Delete
  8. Next
Anyone knows whats wrong?
Thanks.
Feb 13 '07 #1
Share this Question
Share on Google+
1 Reply


MMcCarthy
Expert Mod 10K+
P: 14,534
Try this ...


Expand|Select|Wrap|Line Numbers
  1. Dim frm As Form
  2. Dim myControl As Control
  3.  
  4.   Set frm = Forms!Customers
  5.  
  6.   For Each myControl In frm.Controls  'I also tried myControl in frm
  7.     myControl.Format = Null
  8.   Next
  9.  
  10.  
Feb 14 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.