Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    RMittelman is offline Advanced
    Windows 10 Access 2016
    Join Date
    Dec 2010
    Location
    Simi Valley, CA
    Posts
    211
    Thanks to everybody who has helped me on this project.



    I figured out why I couldn't Dim an object as my class types. They were all declared in the reference DB with Instancing set to Private. For some reason, clsInfo was set to Public Not Creatable.

    So I set all classes in the reference DB to Public Not Creatable. I already had a Create function for each class, but instead I changed to a single class factory function:

    Code:
    Public Function CreateClass(className As String) As Object
    
        Dim myClass As Object
        
        Select Case className
            Case "clsChilkat"
                Set myClass = New clsChilkat
            Case "clsExcel"
                Set myClass = New clsExcel
            Case "clsFileDialog"
                Set myClass = New clsFileDialog
            Case "clsInfo"
                Set myClass = New clsInfo
            Case "clsOutlook"
                Set myClass = New clsOutlook
        End Select
        Set CreateClass = myClass
        Set myClass = Nothing
    
    
    End Function
    I was also having issues with public enumerations in my classes not being "seen" by the client DB. Making the classes Public Not Creatable solved this as well.

    Once again, thanks for all of the input. I will keep checking this thread for any comments or updates.

  2. #17
    RMittelman is offline Advanced
    Windows 10 Access 2016
    Join Date
    Dec 2010
    Location
    Simi Valley, CA
    Posts
    211
    Everything is working fine, except for some odd UI issues.

    I have a custom MsgBox function which lets me use custom button labels among other things.
    It uses a generic pop-up form which is named frmPopup. The form already has all the controls I need for this functionality. They are not displayed correctly at design-time, but part of the code of loading this form moves and resizes controls so that when it's finally displayed everything looks similar to a standard message box.

    This form and its code resides in my new AccessCommonCode reference project.

    When I use this form, it causes my screen to flicker and switch modes rapidly 3 or 4 times before the form is displayed.
    It happens very fast, but if I watch carefully, I can see the ribbon active menu switch back and forth between the normal "Home" menu and the "Form Design" menu. Also I see the properties pane on the right appear and disappear rapidly.

    I put Application.Echo False and Application.Echo True around the code that calls this custom MsgBox function. I also tried putting those commands around the actual code inside the reference DB. None of this works.

    This never happened before I moved my utility functions into the reference DB.

    Now I'm thinking that maybe the Application.Echo command doesn't work in the reference project. Just like I need to switch CurrentDb to CodeDb when I am executing code in the reference project, is there a different object I need to use instead of the Application object inside of my code in the reference DB?

    Thanks...

  3. #18
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    try opening the form hidden, move your controls around then make it visible - works for me

    but just noticed you say

    I can see the ribbon active menu switch back and forth between the normal "Home" menu and the "Form Design" menu
    Sounds like you are putting the form into design view to move the controls? There is no need to do that

    the other thing you can try instead of application.echo is turn form painting off, rather than the whole application

    code is

    me.painting=true/false

  4. #19
    RMittelman is offline Advanced
    Windows 10 Access 2016
    Join Date
    Dec 2010
    Location
    Simi Valley, CA
    Posts
    211
    Quote Originally Posted by CJ_London View Post
    try opening the form hidden, move your controls around then make it visible - works for me

    but just noticed you say



    Sounds like you are putting the form into design view to move the controls? There is no need to do that

    the other thing you can try instead of application.echo is turn form painting off, rather than the whole application

    code is

    me.painting=true/false
    Thanks CJ_London for the reply. I am opening the form as dialog, read-only with arguments in a string. In the form_load event, I size & position the controls. Nowhere do I put it in design mode. It's unclear why this is happening.

  5. #20
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    No idea then -,So did you try the painting property?

  6. #21
    RMittelman is offline Advanced
    Windows 10 Access 2016
    Join Date
    Dec 2010
    Location
    Simi Valley, CA
    Posts
    211
    Quote Originally Posted by CJ_London View Post
    No idea then -,So did you try the painting property?
    So strange. I've been using this enhanced MsgBox for months, with no problems. It must be related to it having been moved to my reference DB.
    I use the form, frmPopup, for 2 different purposes. One is the enhanced MsgBox, the other is a simple font picker. In both cases, all the controls are there on the form already. My code simply moves and sizes the controls and makes the required controls visible. I'm getting no issues at all when I open the form as a font picker. Only when opening it as a MsgBox.

    Yes, I did try turning off painting, and that didn't do anything. Thanks anyway...

  7. #22
    RMittelman is offline Advanced
    Windows 10 Access 2016
    Join Date
    Dec 2010
    Location
    Simi Valley, CA
    Posts
    211
    For the time being, I'm not using the extended MsgBox functionality on the most flickering usage.

    If anybody has any idea why this happens when this particular form is being manipulated, please help. This is not normal flickering, the Access window is flashing and the menu keeps cycling between the normal menu and the Form Design menu.

    Now there is a new issue.
    I have a utility function which I've moved to the reference database. It is designed to display either a message or progress on the Status Bar. Here is the code:

    Code:
    Public Enum StatusBarTypeEnum
        sbtNone = 0
        sbtClearStatus = 1
        sbtClearProgress = 2
        sbtInitProgress = 3
        sbtShowStatus = 4
        sbtShowProgress = 5
    End Enum
    
    
    Public Enum AcSysCmdAction
        acSysCmdInitMeter = 1
        acSysCmdUpdateMeter = 2
        acSysCmdRemoveMeter = 3
        acSysCmdSetStatus = 4
        acSysCmdClearStatus = 5
    End Enum
    
    Public Sub ShowStatusBar(action As StatusBarTypeEnum, Optional Message As String = "", Optional Value As Integer = 0, _
                             Optional pauseSeconds As Single = 0, Optional playBeep As Boolean = False)
    
    
        Dim result      As Variant
        
        If playBeep Then Beep
        
        If action = sbtNone Then
            result = SysCmd(acSysCmdRemoveMeter)
            result = SysCmd(acSysCmdClearStatus)
        ElseIf action = sbtClearProgress Then
            result = SysCmd(acSysCmdRemoveMeter)
        ElseIf action = sbtClearStatus Then
            result = SysCmd(acSysCmdClearStatus)
        ElseIf action = sbtInitProgress Then
            result = SysCmd(acSysCmdInitMeter, Message, Value)
        ElseIf action = sbtShowStatus Then
            result = SysCmd(acSysCmdSetStatus, Message)
        ElseIf action = sbtShowProgress Then
            result = SysCmd(acSysCmdUpdateMeter, Value)
        End If
        DoEvents
        If pauseSeconds > 0 Then Pause pauseSeconds
    
    End Sub
    Here is how I use this in my code:

    Code:
            ShowStatusBar sbtInitProgress, "Creating emails...", 100, 2
            recs = rs.RecordCount
            rec = 0
    
             ' start my code loop here...
    
            ' do some code in the loop
    
                rec = rec + 1
                pct = recs \ rec
            ShowStatusBar sbtShowProgress, , pct
    
            '  Next statement here...
    
            '  After end of loop, clear the status area
            ShowStatusBar sbtNone
    This has always worked for me, but now it's not. I'm wondering why running this code from the reference project is messing this up.
    Maybe SysCmd works in the current (main) DB, but not from the reference DB?

    Thanks...

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 10-23-2017, 12:46 AM
  2. Unable to access Forms and Modules
    By ckinman1 in forum Security
    Replies: 9
    Last Post: 10-14-2016, 12:58 PM
  3. Replies: 1
    Last Post: 04-26-2016, 03:56 AM
  4. Auto Import Excel Data into a Running Access Database
    By novice1979 in forum Programming
    Replies: 5
    Last Post: 12-02-2014, 08:19 AM
  5. Replies: 2
    Last Post: 01-08-2013, 03:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums