473,756 Members | 9,160 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1497
<vo***********@ gmail.com> wrote in message
news:11******** *************@g 14g2000cwa.goog legroups.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.Back Color=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******** *************@g 43g2000cwa.goog legroups.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_LOGI N As String = "Marco"

Private Declare Function GetUserName Lib "advapi32.d ll" Alias _
"GetUserNam eA" (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(str Login, 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_LOGI N Then
frm.Section("De tail").BackColo r = -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
3090
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 I want to send the error report to Microsoft. Has anybody seen this type of error message and what can I do to prevent it from happening. Am I doing something illegal in my code? It used to work but I have added conditional formatting to a subform...
2
394
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 UPDATE query. It doesn't work and the debugger gives me "Type Mismatch" error. Any help would be greatly appreciated. Thanks. Private Sub Form_AfterUpdate() Dim dtDateBooked Dim strSQL As String
3
1729
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 formatting. When this second form closes, it calls a .Requery for the first form. The value in the formatted field updates, but it's formatting does not. What else do I need to do?
0
4286
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 records in the DataGrid). (This is a lab I'm working on in a training book - written by Mr. Gunderloy for MS Exam 70-310). I pasted the following code with numerous errors, however, when I was using a trial VB.net copy I was able to get it to...
4
5044
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 = (Date - rst!DateReceived) & " Days" however, when that runs to update the caption, it says that it cannot find form DisposalRecords
0
1636
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 continuous form, so that only the button related to that particular row is disabled, but any remaining rows that have not been added the button stays enabled.
2
1838
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 form. The form show 2 fields, 1 is a number and the second is a calculated field that says either "Valid" or "Invalid" based on the first fields contents. What I need to do is if the value is Invalid then I'd either like the text or the actual...
8
6012
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 formatting (ie. 4.1). I have changed the data types and altered my variables to insert numbers. I have added a default value of 0 to new records added to the database. Howevern, some of the existing records have a null field in this changed column. CF...
0
9462
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
9287
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
9886
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
9857
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
5155
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
5318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3817
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 we have to send another system
2
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2677
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.