Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2007

Tip: Looking for answers? Try searching our database.

Changing backcolour

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony Williams - 22 Jul 2007 13:28 GMT
I'm trying to change the backcolour of all my forms and am using this code
in a module

Public Sub ChangeAllControlProps()
Dim dbCur As Database
Dim doc As Document
On Error GoTo ErrHandler

   Set dbCur = CurrentDb
For Each doc In dbCur.Containers("Forms").Documents
   DoCmd.OpenForm doc.Name, acDesign
   Section.backcolor = RGB(255, 255, 255)
   DoCmd.Close acForm, doc.Name, acSaveYes
   Next doc
ExitHere:
   Set dbCur = Nothing
   Exit Sub

ErrHandler:
   Select Case Err.Number
   Case 438   'Property does not exist
       Resume Next
   Case Else
       MsgBox Err.Number & " - " & Err.Description
       Resume ExitHere
   End Select
End Sub

It seems to run through all the forms but doesn't change the backcolour and
when it's finished running I get an error message
424-Object required
Anyone help me with this?
Thanks
Tony
Baz - 22 Jul 2007 13:44 GMT
This line looks wrong:

   Section.backcolor = RGB(255, 255, 255)

You need to specify which form and which section e.g.:

   Forms(doc.Name).Section(acDetail).backcolor = RGB(255, 255, 255)

> I'm trying to change the backcolour of all my forms and am using this code
> in a module
[quoted text clipped - 30 lines]
> Thanks
> Tony
Tony Williams - 22 Jul 2007 14:12 GMT
Thanks Baz that worked just fine! How would I amend that line to change the
backcolour of the form header?
Cheers
Tony
> This line looks wrong:
>
[quoted text clipped - 40 lines]
>> Thanks
>> Tony
Baz - 22 Jul 2007 16:15 GMT
Forms(doc.Name).Section(acHeader).backcolor = RGB(255, 255, 255)

> Thanks Baz that worked just fine! How would I amend that line to change the
> backcolour of the form header?
[quoted text clipped - 44 lines]
> >> Thanks
> >> Tony
Tony Williams - 22 Jul 2007 16:35 GMT
Hi Baz this gives an error message
2462-The section number you entered is invalid
Any ideas?
Thanks
Tony
>    Forms(doc.Name).Section(acHeader).backcolor = RGB(255, 255, 255)
>
[quoted text clipped - 48 lines]
>> >> Thanks
>> >> Tony
Baz - 23 Jul 2007 09:02 GMT
That's because it's found a form which doesn't have a header.  Just trap the
error and ignore it.

> Hi Baz this gives an error message
> 2462-The section number you entered is invalid
[quoted text clipped - 53 lines]
> >> >> Thanks
> >> >> Tony
Tony Williams - 23 Jul 2007 09:18 GMT
Thanks Baz
Tony
> That's because it's found a form which doesn't have a header.  Just trap
> the
[quoted text clipped - 59 lines]
>> >> >> Thanks
>> >> >> Tony
Tony Williams - 22 Jul 2007 14:17 GMT
And what about changing the backcolour of all tabcontrols?
Thanks, really appreciate this
Tony
> This line looks wrong:
>
[quoted text clipped - 40 lines]
>> Thanks
>> Tony
Baz - 22 Jul 2007 16:25 GMT
No can do, tab controls don't support background colours.

> And what about changing the backcolour of all tabcontrols?
> Thanks, really appreciate this
> Tony
Tony Williams - 22 Jul 2007 16:33 GMT
Thanks Baz for that
Tony
> No can do, tab controls don't support background colours.
>
>> And what about changing the backcolour of all tabcontrols?
>> Thanks, really appreciate this
>> Tony
missinglinq - 22 Jul 2007 19:53 GMT
"2462-The section number you entered is invalid"

This is just a guess, but perhaps you have forms with the header height set
to zero?This might cause an error to be thrown when trying to set the
backcolor on a form section that, in reality, doesn’t exist.

As for changing the tabbed page colors, the prolific Stephen Lebans has a
workaround here:

http://www.lebans.com/tabcolors.htm

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Tony Williams - 23 Jul 2007 09:23 GMT
Thanks I'll have a look at that
Tony
> "2462-The section number you entered is invalid"
>
[quoted text clipped - 7 lines]
>
> http://www.lebans.com/tabcolors.htm
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.