Solved

Why does MS Access GUI ignore some combobox properties being set through VBA?

Posted on 2012-04-12
14
342 Views
Last Modified: 2012-04-18
After some modifications mainly in VBA code combobox in one of the most important forms
lost some portion of its functionality. It displays it in the older version, but I cannot figure out why it does not in the newer one. Please help with at least where to look at advice.
The attached image illustrates how the same actions in Immediate Window result in different effects in both versions of MS Access database. How can I restore functionality wanted?
Thanks.
Disobedient-BorderColor.jpg
0
Comment
Question by:midfde
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
14 Comments
 
LVL 21
ID: 37840061
What version of Access is the newer version?

If you set the color manually in design mode on the form.  Open the form, What does is then show as the color code in the immediate window?
0
 
LVL 1

Author Comment

by:midfde
ID: 37840279
Both versions of MDB files run under the same Access 2003 and are located in the same folder with different file names.

?Syscmd(acSysCmdAccessVer)
11.0

Open in new window

See also the attached image.
Although I investigated properties in form's design view, I did whatever I could to prevent from any changes anywhere except for VBA code.
env.jpg
0
 
LVL 21
ID: 37840452
Ah ... older versions of the database not older version of Access.

I make sure there is not an issue with the VBA code not getting recomplied properly, I would recommend decompling the VBA code for the database and recompiling.

Is your database split? Do you you compile the database into an mde? Do you have the same issue with the mde?

.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 1

Author Comment

by:midfde
ID: 37840587
The database has 4 categories of (~250) tables:
1) ~20 local tables;
2) -3) 200+ linked to two SQL Server databases;
4) the rest are linked to an MDB file.

This application does not ever use MDE rendition to work with.
 This
c:\1>"C:\Program Files\Microsoft Office\OFFICE11\msaccess.exe" /decompile "\\fdefs1...
did not help
0
 
LVL 21
ID: 37840700
I like to be sure the VBA has not got corrupted. If this was the issue,  it is very difficult to track it down. Now we know the VBA is OK.

Next we need to see if it may be a corrupted form.  I like to export the form to a text file. delete the form. compact. import the form back into the database.  See: Backing up and Restoring Objects

If that does not fix the issue the next thing I would do it create a blank new database and import in all the objects.

<<This application does not ever use MDE rendition to work with.>>
I deploy front ends as a MDE/ACCDE for many reason. One of the main reasons is that it insures the VBA code stays properly compiled and prevents VBA code corruption.
0
 
LVL 1

Author Comment

by:midfde
ID: 37840818
Thanks, TheHiTechCoach.
I need some time.

>>...and import all objects.
Sounds (fairly) good for the 6 kinds, but what about relationships, I/O specs, anything else that does not come to my mind right away and that is not queries, tables,.., macros.?

I'll conduct additional investigation of other similar forms / controls.
0
 
LVL 21

Assisted Solution

by:Boyd (HiTechCoach) Trimmell, Microsoft Access MVP
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 200 total points
ID: 37840979
<,Sounds (fairly) good for the 6 kinds, but what about relationships, I/O specs, anything else that does not come to my mind right away and that is not queries, tables,.., macros.?>>

Relationship are actually defined  in the back end. Be sure to select the options>> button to get to the advanced options. You can select to import everything but the VBA references..

Import Options
0
 
LVL 1

Accepted Solution

by:
midfde earned 0 total points
ID: 37843021
The subject text of y question was “Why [in the world] does Access ignore...?”
The best answer I found was: It happens because sometimes settings for the BorderStyle, BorderColor, and BorderWidth properties are ignored by design.
0
 
LVL 1

Author Comment

by:midfde
ID: 37843091
The follwing code does work:
Private Sub setMdtBorderColor()
    Const SUNKEN = 2, FLAT = 0
    Const TRANSPARENT = 0, SOLID = 1
    With frm(SOURCE_DATA_TABLE_NAME)
        If TableExists(.value) Or Trim(Nz(.value)) = vbNullString Then
            .SpecialEffect = SUNKEN
            .BorderStyle = TRANSPARENT
            .BorderColor = vbBlack
            .ControlTipText = "Verified trend data table name"
            
        Else
            .SpecialEffect = FLAT
            .BorderStyle = SOLID
            .BorderColor = vbRed
            .ControlTipText = "Expert has not found this table in the database"
        End If
    End With
End Sub

Open in new window

0
 
LVL 21
ID: 37843099
<<It happens because sometimes settings for the BorderStyle, BorderColor, and BorderWidth properties are ignored by design.>>
That does not explain why it was once working but now it is not working.

You originally said:
<<... ,It displays it in the older version, but I cannot figure out why it does not in the newer one.  >>
I took that as meaning it once was working but has stopped.

In almost every data entry form I change the  BorderStyle, BorderColor, and BorderWidth properties for controls.    I have never had it ignored are runtime.  

In your case it may be corruption or other VBA code that is blocking it.
0
 
LVL 1

Author Comment

by:midfde
ID: 37843341
>>...It displays it in the older version, but I cannot figure out why...
Meticulous collation of properties was sufficient to find out why. It is verifiable, whilst this
"...corruption or other VBA code that is blocking it"
does not look like it is.
Thanks again.
0
 
LVL 21
ID: 37843904
<<The only my excuse is that I consider a MDB file as “on-demand” instance of the application that by itself resides in Visual Source Safe (VSS) database, whose.”Data and Misc Objects” thing has been doing its job very well for years.>>

I have used VSS for many applications. I still deploy the front end as an MDE without any issues.  It is not different that using VSS with other programming languages. The source code (with Acess it is an .mdb) is tracked with VSS. When ready to deploy you compile the application into an MDE with Access or a .exe with other languages.

Good luck with your project.
0
 
LVL 1

Author Closing Comment

by:midfde
ID: 37859693
Dear TheHiTechCoach,
I thank you for your interest and collateral information. I did not know how easy it was to handle relations and (!) toolbars with “Import Objects” dialog box. The only my excuse is that I consider a MDB file as “on-demand” instance of the application that by itself resides in Visual Source Safe (VSS) database, whose.”Data and Misc Objects” thing has been doing its job very well for years.  However this is definitely a (lyrical) digression.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question