473,626 Members | 3,221 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there a way to update all exisiting forms back/fore color with code in db?

46 New Member
I am new to vba. I have 2 old Access databases that were developed over time. All forms have varying color and design. I need to add a picture, and update all forms to the same color and design.

Is there some way to do this with a function?

I was trying to loop through msysobjects and update properties but it's not working.
Aug 4 '10 #1
7 1964
NeoPa
32,567 Recognized Expert Moderator MVP
There certainly is Vikki.

CurrentProject. AllForms would be your starting point for this. Let us know if you need any more detail.

Welcome to Bytes!
Aug 7 '10 #2
Vikki McCormick
46 New Member
NeoPa

Thanks. Cool. That is good to know. It might not be the best approach, but I used the Forms object. I also had to update all the Title text, combo boxes etc. to improve the look of the User Interface. So I wrote something that checked to see if there were labels, combos, commands, etc., then applied a standard design. I made it our standard format tool. Guess I will have to try and refine it using the allforms command.

The good news, it all worked till I had to create a control and load a picture. I have not gotten that working yet. Any suggestions for that let me know. I just want to insert an banner image at the top of the form. I was trying to use LoadPicture, but the program stops in the middle with no error message.

Thanks again.

Vikki

Example:
Expand|Select|Wrap|Line Numbers
  1. Forms(myForm).Detail.BackColor = RGB(192, 192, 192)
  2. For i = 1 To 100
  3.    If funControlExists(Forms(myForm), myLabel) = True Then
  4.    Forms(myForm).Controls(myLabel).FontName = "Tahoma"
  5.    Forms(myForm).Controls(myLabel).FontSize = 10
  6.    Forms(myForm).Controls(myLabel).FontBold = 1
  7.    Forms(myForm).Controls(myLabel).ForeColor = 0
  8.      End If
  9.    myLabel = "Label" & i
  10.    Next i
Aug 7 '10 #3
NeoPa
32,567 Recognized Expert Moderator MVP
The Forms collection is limited for your needs in that it contains only those forms that are currently opened.

As for the new question, this should be posted in its own thread. Multiple questions in the same threads just get messy, which is why we don't allow it here. Before posting it again, you may want to make your situation a little clearer. More of the code would be helpful to give it context, and a clearer description of what happens when you run it would be too.
Aug 7 '10 #4
Vikki McCormick
46 New Member
Yes. I open the form first. I will start a new thread for my other question, and post my program. You will probably see a lot that could be written better.

Thanks again.
Aug 7 '10 #5
ADezii
8,834 Recognized Expert Expert
The following code can be used as a Template and will show you how to Modify specific Controls on every Form in your Database. Any questions, feel free to ask.
Expand|Select|Wrap|Line Numbers
  1. Public Function fUpdateForms()
  2. On Error Resume Next
  3. Dim intFrmCtr As Integer
  4. Dim ctl As Control
  5. Dim frm As Access.Form
  6. Dim strFormName As String
  7.  
  8. For intFrmCtr = 0 To CurrentDb.Containers("Forms").Documents.Count - 1
  9.   strFormName = CurrentDb.Containers("Forms").Documents(intFrmCtr).Name
  10.     DoCmd.OpenForm strFormName, acDesign, , , , acHidden
  11.       For Each ctl In Forms(strFormName).Controls
  12.         Select Case ctl.ControlType
  13.           Case acLabel
  14.             ctl.FontSize = 16
  15.           Case acTextBox
  16.             ctl.BackColor = vbRed
  17.           Case acCommandButton
  18.             ctl.Caption = "Testing"
  19.           Case acComboBox
  20.             ctl.SpecialEffect = 2       'Sunken
  21.         End Select
  22.       Next
  23.       DoCmd.Close acForm, strFormName, acSaveYes
  24. Next
  25. End Function
The critical sequence is as follows:
  1. Open each Form in the Database in Design View and Hidden Mode.
  2. For each Form, loop thru all the Controls on the Form.
  3. Determine each Control's Type on every Form.
  4. Set specific Properties depending on the Control Type.
  5. Close/Save each Form.
Aug 8 '10 #6
Vikki McCormick
46 New Member
Wow. It helps to know something. Yes this will work well. Thanks.
Aug 8 '10 #7
ADezii
8,834 Recognized Expert Expert
You are quite welcome. Any questions, feel free to ask.
Aug 8 '10 #8

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

Similar topics

19
3232
by: Vinod | last post by:
Hi, I have got a peculiar requirement. I want to distinquish between the color codes. I have got two text fields and i will enter the color codes there. The first text field will have background color The second will have text color. I want to validate if background color is dark then only light colors should
2
2025
by: Mike | last post by:
I have an ASP.NET webform that has an HTML button (with an onClick event that calls a javascript function) and a Web Forms button (the code behind click event saves data back to a SQL DB). The javascript function basically creates a variable such as: var someStrings = "foo1.jpg,foo2.jpg,foo3.jpg,foo4.jpg" I really need to be able to access this javascript variable from the Click event of my Web Forms button so that I can pull the...
6
2494
by: Babu Mannaravalappil | last post by:
Can somebody please help me figure out why the following method exceptions out? Execution at the line marked with ********** hangs for about 15 seconds and then I get an error that says an Unhandled StackOverFlowException occurred. The execution does not even get passed to the catch block. At the time of my test, only one of 12 tables in the dataset (catalogsDS) really has changes. The dataset is not a huge one. Most tables have less...
2
4251
by: John | last post by:
Hi, I have a web form accounting app. In certain instances it causes trouble if the user clicks the Back button. I've read several posts that indicate that it is not recommended (or even possible) to try to disable the Back button. So, what I did was save a session variable with the name of the current webform and then check this session variable on page load to make sure the user was not coming from a page that was not acceptable.
2
2191
by: Melisa | last post by:
Hi, 1. I want to change the alpha value of fore color of a button at run time to fade it. 2. I have a button and some text is assigned to it`s Text property. 3. I want to fade the color of this text OnMouseMove event. 4. When i change the alpha value of back color of the button, it shows same behaviour on MouseMove event but when i change the alpha value of the button the text color doesn`t fade.
1
981
by: Karthiga1984 | last post by:
is it possible to change some rows fore color??? for example the particular column number is greater than 0 that records would be appear in red color(forecolor is red) ..remaining recods would be appear in blue color. all records is in same combo box... is it possible.???please help me with source code or some idea to do it. please do help..
2
2174
by: James | last post by:
When property 'Enabled' is set to 'false', the text back ground color always turn to gray. Can I change this color? From http://developmentnow.com/g/36_2003_7_0_0_0/dotnet-languages-csharp.htm Posted via DevelopmentNow.com Groups http://www.developmentnow.com
2
1255
by: =?Utf-8?B?QVZM?= | last post by:
hi, i need the color code of the textbox control 's border style,(Fixed 3d).... by default, what is the color code set for it's border....please help out
0
1148
by: Plack | last post by:
Hello, as I had the same problem as many others with the fixed back and fore color of disabled controls I decided to implement my own controls where exactly this behaviour is provided. I know that it is not "the optimal solution", but it works and I wanted to share it with everybody who is interested in. For more details see the following link: http://manfred-ramoser.jimdo.com/c.php
5
3117
by: Velhari | last post by:
Hi all, if i am having the input as rgb color code and alpha level. Now i want to calculate the rgb color code with applying the alpha level into the rgb color code. Is there any idea folks. for example, if supplied color code is #ec933a with alpha level is 60(approx) we will have to get the output like this #fbebd9. This is just for example i said.
0
8265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8637
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
8364
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
8504
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
7193
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
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
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
4197
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1511
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.