Changing DB property "Themed Form Controls" at runtime

A

Andrew Brill

This is quite an unusual request but we'd like to be able to turn XP themes
on and off during a programs runtime. Reason being we have a new section of
our program that looks great in the XP Theme but we want to join this to an
older program that has tab controls etc which are ruined by the XP theme (as
an aside - it would have been niced if MS had fixed this in one of the
Office SP's!).

Anyway, we got this to turn themes on, but it only takes effect when the
database is reloaded:
CurrentDb.Properties("Themed Form Controls") = True

Now if you do it from the menu, it takes immediate effect so how do we
achieve the same thing in code?

Thanks,
Andrew
 
T

tina

you could try running the menu option from code. here's an example:

Public Sub isBackupDatabase()

On Error GoTo Backup_Err

Dim str As String
str = "Back Up Database..."

CommandBars("Menu Bar").Controls("Tools").Controls("Database
Utilities").Controls(str).accDoDefaultAction

Backup_End:
Exit Sub

Backup_Err:
MsgBox Err.Number & " " & Err.Description, "Administrator:
isBackupDatabase()"
Resume Backup_End

End Sub

substitute the correct menu option names, of course.

hth
 
A

Andrew Brill

Thanks for the suggestion. The thing is, contrary to my first post (my bad
I know!), it's not a specific menu item. It's actually a tick box on the
forms/reports tab of the options screen from the tools menu.
 
T

tina

hmmm, okay. try this out instead:

Application.SetOption "Themed Form Controls", Not
Application.GetOption("Themed Form Controls")

it's essentially a toggle - turns off if on, turns on if off. for details on
SetOption and GetOption, see the SetOption Method and GetOption Method
topics in VBA Help.
note: since you normally open Tools | Options from the db window, i'm
guessing that the toggle won't work on the *currently open* form. i think
you'd have to run the code from a menu form, for instance, before opening
the form you want to see / not see the themes in. you'll have to test it to
find out.

hth
 
A

Andrew Brill

Thanks very much - works great. Funnily enough I have a setoption command on
the line above where I was trying to change theming and it never occured to
me to try that!!
 
T

tina

you're welcome :)


Andrew Brill said:
Thanks very much - works great. Funnily enough I have a setoption command on
the line above where I was trying to change theming and it never occured to
me to try that!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top