Why is Me. suddenly not Okay?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    Why is Me. suddenly not Okay?

    So, I had this bright idea today that didn't quite work out. Or maybe it is working out but requires me to change a habit. I'm working on a form that will be a sub-form of another form. During initial development, I find it easier or better to work on the form as stand-alone entity rather than a sub-form. One reason is that I can edit the form using the entire screen instead of just that portion of the main form allocated to the sub-form.

    Anyway, this sub-form references some objects on the parent form. Those same named objects exist on the sub-form, so I thought why don't I do this:
    Code:
    dim obj as object
    set obj = Me
    and then replace this
    Code:
    me.parent.controlname ...
    to
    obj.controlname
    Then, when I am ready to put the two forms together, all I have to do is change
    Code:
    set obj = me
    to
    set obj = me.parent
    Voila, all good, right? Well, the weirdest thing happened. Suddenly, I got compile errors in both the main form and sub-form. The compiler was telling me that object names didn't exist that I knew darn well existed. I have been running the main form for several days.

    I tried this experiment. I changed an object name from "Salesman_filte r" to "Tsalesman_filt er", and I changed my code from Me.Salesman_fil ter to Me.Tsalesman_fi lter, and then the compiler was happy. The compile error was now reported a few lines further down on a reference to another object. I changed Tsalesman_filte r back to Salesman_filter and the compiler was still happy with the Me. reference, but still unhappy with the following reference to a different object.

    So very weird. Then I tried changing the Me. references to Me! references, and the compiler stopped seeing an error. I changed all my Me. references to Me! references and no more errors.

    What in the world happened? Can any of you explain this?

    Thanks!
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32661

    #2
    Hi Jim.

    I'm not sure your explanation paints a very clear picture of the situation you're in. Do you have a minimalised (Remove everything except items germane to the issue) version you could possibly Zip & attach. I suspect I'll also require some straightforward instructions detailing precisely what you did; in which order; what results you saw at each stage.

    I can say that your description doesn't match any expectation I'd have, regardless of how I interpreted what you've said. Nothing comes to mind at all at this point. However, I'm happy to look into it in more detail once I have a clear understanding of what I need to focus on.

    It may be helpful also, to include information from Colin's Access/Windows/Office365 Version Checker. I have access only to 2019 ATM so anything that needs a version later than that will keep me from investigating further. Very unlikely of course.

    Comment

    • jimatqsi
      Moderator Top Contributor
      • Oct 2006
      • 1293

      #3
      NeoPa,
      I'm sorry I have not gotten back to this yet. I appreciate your interest in helping. I did fail to mention in my post that I have tried decompiling and recompiling, as well as Compact and Repair. I have backups that I can use to, presumably, repeat the process and see if the issue follows suit.

      However, at the moment other issues are more pressing. The code my post refers to is part of a project for the not too distant future, but not today. I do want to understand what happened, so I will return to this, and hopefully, soon.

      The question about version is certainly relevant. I've got a developer's license and the details are
      MS 365 Apps for Enterprise
      Version 2312 (Build 17126.20132 Click to Run)
      Current Channel

      Otherwise, I have reread my post and don't see anything I would change, except those steps I performed but didn't mention. I mean the post describes pretty well the sequence of events as I remember them.

      I'd have to import some local data and change some links before I could hope to make a shareable database. I may yet do that, because I'd like for someone else to see this.

      I will try to reproduce this and post an update.

      Thanks for your interest!

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32661

        #4
        Hi Jim.

        There's no rush. I hover & monitor most of the time but I can't promise I'll be able to throw much light on this. From what I understand this isn't behaviour I'd expect. Being able to reproduce your steps exactly would certainly help when you get to that stage, but I'll look at whatever you have. No promises even if you made a video showing all your steps exactly, but generally the more accurately I follow in your footsteps the higher the chance there is of me being able to help.

        I'm also only able to test within 2019 ATM, so if it's the result of a recent update then I probably won't even get to see it.

        You do what you can & I'll do what I can, and I hope we can manage to find something between the two of us :-)

        Comment

        Working...