Home > Software design >  How can i persistently set the default values for control elements in ms access
How can i persistently set the default values for control elements in ms access

Time:04-23

I am using a Plugin for Version Control with gitlab. This Plugin exports a whole Database to Textfiles which can be commited to a git-repository. You can than build the Database from these Textfiles. I am very happy with this Plugin, but I have encountered an issue related to the build functionality.

When the Plugin builds the database from text, it creates a new database and creates all objects as described in the textfiles. It does however seem to use the default format values for the control elements and these default values are messed up (Buttons are always white) on the MS-Access Version of my partner 500km away.

Now changing the default style for a database is actually not that difficult as described here: Change default style of MS Access elements

However setting the default values like this is not persistent. A new database on her machine always falls back to to White Buttons, wrecking the whole appearance. I therefore need to set this values permanently but I haven't found out, where I can do that.

If anyone knows, that would be a great help.

Edit1: I do use the PlugInn already on 2 different machines, my Worklaptop and my Desktop PC and exporting and building the database works fine with no issues regarding the theme.

I also checked my source files, regarding @PeterTheme suggestions about the UseTheme property and they are set to true, see the following example of a ControlButton

Begin CommandButton
            Width =1701
            Height =283
            FontSize =11
            FontWeight =400
            FontName ="Calibri"
            ForeThemeColorIndex =0
            ForeTint =75.0
            GridlineThemeColorIndex =1
            GridlineShade =65.0
            UseTheme =1
            Shape =1
            Gradient =12
            BackThemeColorIndex =4
            BackTint =60.0
            BorderLineStyle =0
            BorderThemeColorIndex =4
            BorderTint =60.0
            ThemeFontIndex =1
            HoverThemeColorIndex =4
            HoverTint =40.0
            PressedThemeColorIndex =4
            PressedShade =75.0
            HoverForeThemeColorIndex =0
            HoverForeTint =75.0
            PressedForeThemeColorIndex =0
            PressedForeTint =75.0
        End

However on my partners PC the useTheme is set to False after the rebuild. I suspect her System doesn't know what to do with the ColorIndex Properties. But even in a new database on her system the default Values are FFFFFF (white) on many of those.

The Plugin offers an "export Theme" Option, which i tried but didn't change anything. I also tried to export my Theme,sent it to her and let her import it. Also nothing.

CodePudding user response:

It might be simpler to use the native, though undocumented, commands for this.

Apart from table data, they will write/read any object to/from a text file, for example a form:

SaveAsText acForm, "YourForm", "C:\Test\YourForm.txt"
LoadFromText acForm, "YourForm", "C:\Test\YourForm.txt"

These commands was meant to serve version control systems like Visual SourceSafe.

CodePudding user response:

To avoid problems with "Missing" Themes Access Databases, Word Documents, Excel Spreadsheets and Powerpoint presentations always contain a copy of the last Theme used. That's part why a word docx that contains only a few characters is thousands of characters in size.

The problem you describe sounds like the "UseTheme" parameter is not being set = True in the text file and hence the target database.

A textfile for a form created with "saveAsText" has sections for control defaults if any are different from the standard used by the Access version used while creating the form. From 2010 onwards the "useTheme" property is standard in accdb. Further down the textile are sections for each control.

  • Related