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.
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!
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: - Forms(myForm).Detail.BackColor = RGB(192, 192, 192)
-
For i = 1 To 100
-
If funControlExists(Forms(myForm), myLabel) = True Then
-
Forms(myForm).Controls(myLabel).FontName = "Tahoma"
-
Forms(myForm).Controls(myLabel).FontSize = 10
-
Forms(myForm).Controls(myLabel).FontBold = 1
-
Forms(myForm).Controls(myLabel).ForeColor = 0
-
End If
-
myLabel = "Label" & i
-
Next i
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.
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.
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. - Public Function fUpdateForms()
-
On Error Resume Next
-
Dim intFrmCtr As Integer
-
Dim ctl As Control
-
Dim frm As Access.Form
-
Dim strFormName As String
-
-
For intFrmCtr = 0 To CurrentDb.Containers("Forms").Documents.Count - 1
-
strFormName = CurrentDb.Containers("Forms").Documents(intFrmCtr).Name
-
DoCmd.OpenForm strFormName, acDesign, , , , acHidden
-
For Each ctl In Forms(strFormName).Controls
-
Select Case ctl.ControlType
-
Case acLabel
-
ctl.FontSize = 16
-
Case acTextBox
-
ctl.BackColor = vbRed
-
Case acCommandButton
-
ctl.Caption = "Testing"
-
Case acComboBox
-
ctl.SpecialEffect = 2 'Sunken
-
End Select
-
Next
-
DoCmd.Close acForm, strFormName, acSaveYes
-
Next
-
End Function
The critical sequence is as follows: - Open each Form in the Database in Design View and Hidden Mode.
- For each Form, loop thru all the Controls on the Form.
- Determine each Control's Type on every Form.
- Set specific Properties depending on the Control Type.
- Close/Save each Form.
Wow. It helps to know something. Yes this will work well. Thanks.
ADezii 8,834
Recognized Expert Expert
You are quite welcome. Any questions, feel free to ask.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
|
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...
|
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...
|
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.
|
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.
| |
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..
|
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
|
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
|
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
|
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.
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
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();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |