473,387 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Update form formatting on FLY?

Hi Everyone,

Is it possible to create some code which can automatically update my
forms formatting?
I have a small database with a form which is periodically changed. When
the db is returned to me the form looks completely different. Different
fore- and background colors, font types etc...

Is there something in code I can use to set the form back to how I
normally use it?

Marco

Nov 13 '05 #1
3 1483
<vo***********@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Hi Everyone,

Is it possible to create some code which can automatically update my
forms formatting?
I have a small database with a form which is periodically changed. When
the db is returned to me the form looks completely different. Different
fore- and background colors, font types etc...

Is there something in code I can use to set the form back to how I
normally use it?

Marco


Whilst it is possible to do this, if someone is altering the design of the
form against your will, they could alter the code too. If you sent the
database to be altered, but didn't want this form to be touched, then what
did you need changing? Perhaps just the data? Also, are you sure the other
person is not expressing the same frustration that someone keeps changing
the form design.
If you only needed the data changing then consider splitting the database
front end (forms, reports, etc) and back end (only data tables). Send
across both bits but only use the returned backend.
If the person is changing the form because he has problems with his eyesight
or has a small/low resolution monitor, then it may make sense for you to
keep different front ends. If there is no real reason for the form to be
changed, then you could send an mde file to lock down these changes.
If you still require code, then post again, but basically you can set things
like this in the form's open event. Write a sub/function in a module so it
can be re-used for multiple forms, so you could write SetupForm(Me)

Public Sub SetupForm(frm As Form)

frm.Detail.BackColor=255

For Each ctl In frm.Controls
With ctl
Select Case .ControlType
Case acLabel: ' Format the label
Case acTextBox: ' Format the textbox
Case acComboBox: ' Format the combobox
Case acCheckBox: ' Format the checkbox
End Select
End With
Next ctl

End Sub


Nov 13 '05 #2
Brian,

You are right all along. The only problem is, the guy is my boss.... he
keeps making changes to the mdb, which is good of course, but he has
something with forms with a brown background.
I on the other hand want to just the common grey. So I need something,
like you wrote, that I can code into the database once he gets me an
updated version again.

Is there a way I could copy that code from lets say another database
which I call: MyDefValues.mdb into his updated version?

Marco

Nov 13 '05 #3
<vo***********@gmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Brian,

You are right all along. The only problem is, the guy is my boss.... he
keeps making changes to the mdb, which is good of course, but he has
something with forms with a brown background.
I on the other hand want to just the common grey. So I need something,
like you wrote, that I can code into the database once he gets me an
updated version again.

Is there a way I could copy that code from lets say another database
which I call: MyDefValues.mdb into his updated version?

Marco

I am not sure if you both might be changing data, form design, form coding
or what, but if you both agree you need different colours then you need to
identify yourself somehow so the application knows which colours to use.
The example code could be put into a new module, and in the open event of
each form, you write "SetupForm Me".
This example simply looks at your Windows login, and if it is you then your
colours are shown, otherwise his are used. You could extend the code to
change textbox fonts, etc and possibly amend the code so the settings are
read from a table rather than hard-coded as I've done here.

Private Const MY_WINDOWS_LOGIN As String = "Marco"

Private Declare Function GetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Public Function WinLogin() As String

Dim lngResult As Long
Dim strLogin As String

strLogin = String$(254, 0)

lngResult = GetUserName(strLogin, 255)

If lngResult > 0 Then
WinLogin = Left$(strLogin, 254)
End If

End Function

Public Sub SetupForm(frm As Form)

' If it's me then show the standard colour
If WinLogin() = MY_WINDOWS_LOGIN Then
frm.Section("Detail").BackColor = -2147483633
End If

End Sub
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Richard | last post by:
Hi, I have a form that take some time to load due to many comboboxes and at least 8 subforms. When I filter or sort the main form I get an error message and then Access shuts down. They ask if...
2
by: nadmasl | last post by:
I have an MS Access form, where a user enters the date by selecting it from three combo boxes for day, month and year. I convert it to 11-Jan-2004 format and attempt to write to the table with an...
3
by: HateSpam | last post by:
I have a field on a form which shows a field with conditional formatting. From this form, it is possible to open another form where the user can update things which will affect the field with the...
0
by: Parasyke | last post by:
I have a form that I'm trying to get to work in VB.net (Standard). I have a DataGrid and Two Buttons (One for Loading an XML file and another for Updating the file with the changes I make to the...
4
by: Ryan | last post by:
I've got a little bit of code that runs when you enter data in a datasheet view (which is a subform of the form you are in) if rst!DateReceived >= 30 Then Forms!DisposalRecords.Label90.Caption =...
0
by: tdes42 | last post by:
Hi :) I have been banging away at this patchwork piece of code for some time... I'm trying to create a button that will disable after it is successfully used to add records to table1, but on a...
2
by: DeanL | last post by:
Hi guys, I'm using a subform to display a list of values from a single table. The form is showing the values in "continuous forms" view and there will only ever be two different values for the...
8
by: ndeeley | last post by:
Hi, My database user has just decided that a recent text field in my database needs to be numeric so that some calculations can be run. I've changed it to a double so I can keep the point...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.