473,498 Members | 1,815 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 1956
NeoPa
32,557 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,557 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
3210
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 ...
2
2010
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...
6
2470
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...
2
4239
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...
2
2176
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...
1
978
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...
2
2163
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 ...
2
1248
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
1142
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...
5
3111
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. ...
0
7126
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,...
0
7210
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...
1
6891
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...
0
7381
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...
1
4916
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4595
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...
0
1424
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
659
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
293
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...

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.