473,805 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.BackStyle Missing

NeoPa
32,579 Recognized Expert Moderator MVP
I have a project I'm working on where I want to disable editing on a form in certain circumstances. To avoid confusing the operator, I would like to change the appearance of the form so that is visually different between the two modes. A sort of visual clue if you like.

I developed the following code, but I find that this won't compile (to my surprise) :
Expand|Select|Wrap|Line Numbers
  1. Private Sub chkLocked_AfterUpdate()
  2.     Dim ctl As Object     'Same problem if done As Control
  3.  
  4.     With Me
  5.         .AllowEdits = (Not .chkLocked)
  6.         For Each ctl In .Detail.Controls
  7.             .BackStyle = .chkLocked
  8.         Next ctl
  9.     End With
  10. End Sub
The error message is "Method or data member not found" and the .BackStyle on line #7 is highlighted (yellow).

Does anyone have any explanation? I have checked various of the controls (TextBox; Label; ComboBox; CheckBox) and only CheckBox doesn't have this property.
Jun 6 '09
12 4546
FishVal
2,653 Recognized Expert Specialist
@ADezii
Hello, ADezii.

The 2nd argument of VBA.Collection. Add method is a text key which could be used instead of positional index in a way we are accustomed to.

ex:
Expand|Select|Wrap|Line Numbers
  1.     Dim col As VBA.Collection
  2.     Set col = FormSections(Me)
  3.  
  4.     Debug.Print col(1).Name
  5.     Debug.Print col("Detail").Name
  6.     Debug.Print col!Detail.Name
  7.  
If collection is for iteration only, then keys are of no use.
Jun 7 '09 #11
NeoPa
32,579 Recognized Expert Moderator MVP
I appreciate the suggestions chaps.

As my desire is to keep the code simpler, I wouldn't go to the extent of writing a class for this, but the numeric indexes in a loop would be a technique that's preferable to my usage of specific names.

Neither is as tidy as the For ... Each though. I'm not sure why that is not provided by default. It seems quite inconsistent with all the other objects and collections available.

PS. For ... Each can also be used in simple arrays (I found out quite recently). Another reason why I found the lack of support for this in .Section curious.

Thanks for all suggestions anyway :)
Jun 7 '09 #12
ADezii
8,834 Recognized Expert Expert
@FishVal
Thanks for the explanation, FishVal. Always a pleasure.
Jun 7 '09 #13

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

Similar topics

5
1686
by: Steven T. Hatton | last post by:
If you happen to have Accelerated C++ by Koenig and Moo, and haven't gotten around to reading it, I suggest you count the pages between page 18 and page 51. I came up with zero. This is very disappointing since I have been intending to read the book for some time now. I finally picked it up with the expectation that I would breeze through it as a review and an alternative expert perspective on C++. Now it looks as though I will have to...
7
5398
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available from clicking on many of the available topics (mostly methods but some properties are also unavailable). This same problem occurs with many, if not most, keywords. Is there any way I can activate these "missing" help topics? HELP!
102
5752
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler can't tell where a bracket is missing.... a few weeks have past, I requested a feature for the delphi ide/editor "automatic identation of code in begin/end statements etc" and today when I woke up I suddenly released a very simple solution for this...
0
3097
by: kris | last post by:
hi can any one help me out, i have written a code for Word Indexing using Dll's i think this is an incomplete code for WORD INDEX. I had encountered this error "Error! No index entries found" when i opened word document can any one fill out the missing code with this.
17
3037
by: Justin Emlay | last post by:
I'm hopping someone can help me out on a payroll project I need to implement. To start we are dealing with payroll periods. So we are dealing with an exact 10 days (Monday - Friday, 2 weeks). I have a dataset as follows (1 week to keep it short): Employee 1 - Date 1 Employee 1 - Date 2
3
2130
by: JD | last post by:
Is it possible to have a clear backstyle for a lable control? I want to write some text on a lable and I want the background of the label to match the color of the control I am placing the label on where the color of that control will be changing will be changing. Is this doable? If not, is there a control I can do this with? to have a clear/see through backstyle? Thanks, JD
0
1688
by: youth | last post by:
I am trying to bind the DB2 utlities to a new database that was created by our DBAs. Each time I try I get the following: db2ajgrt.bnd - No errors db2clish.bnd - 13 errors all for missing package SQLABD01 db2clisn.bnd - 13 errors all for missing package SQLABD01 db2clibh.bnd - 13 errors all for missing package SQLABD01 db2clibn.bnd - 13 errors all for missing package SQLABD01 db2cliv2.bnd - 2 errors both for missing package SQLABD01...
3
2833
by: Fred Chateau | last post by:
Still working on my XML DataSet... Having moved on past difficult and complex problems, resolved with the assistance of everyone here, I find myself facing yet another problem. My XML document breaks the schema. There are missing tags everywhere, on purpose I'm told, because we don't need them. I'm getting a "System.Data: There is no row at position <row number>" error. Hopefully I can workaround this issue. I need to find a way to...
0
1244
by: Wayne | last post by:
The tab control "backstyle" property refuses to work when set to "transparent" in an A2003 database if Windows themes controls are being used. I've seen references to this in a few places, but no fix. If the A2003 database is opened using A2007 the property works fine. Go figure. Does anyone know of a workaround?
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10356
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10361
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10103
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9179
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.