-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module objects need to be saved after importing #236
Comments
Modules need to be saved before other properties can be added, such as custom descriptions and hidden attributes. Fixes #236
Also, I have noticed classes exported from pre 3.4.x versions do not (always??) import as classes, especially if they still have a |
Update: this appears to work after I removed a rouge commit! Huzzah! But like you mentioned, the classes prompt me to save upon building; so we'll probably need to address this. |
I am not seeing this issue with the latest |
Still doing it for me; trying to figure out where/why. |
The DoCmd.RunCmd [compile and save all modules] is what should be saving all the modules for you. You could try breaking at that point and confirming that your project will compile. |
It does; as soon as I click save, it asks if I want to save the modules, then takes me through numerous prompts to save each module/class separately. All I have to do is click "save" and the name is correct. I think it has to do with a property error (#197) that is throwing an error early on and not clearing properly. |
Does this happen when building the Testing database? |
Just checked, and yes, it does! |
Does not happen when building the VCS, though, which is interesting. |
I will see if I can test this again on my end when I get back to my computer. |
Still being prompted to save the class/modules in certain circumstances. If I save them, they save ok, and I can close/reopen and they appear to function.
Which makes me wonder: should we run This avoids the popup, and compiles them when possible, but doesn't introduce odd behavior that doesn't indicate /why/? If there was a prompt that stated there's something blocking them from compiling, then that'd be different, but seems to me we'd want the prompt to not be there when it's caused by something totally unrelated. |
Never mind; that doesn't work. Get error "Error 2046: The command or action 'SaveAllModules' isn't available now. Source: modImportExport.Build" when trying to save them. Out of curiosity, modules are imported last, is there a way to import them first, before other items? I see you moved the Module down in import order in 86e2b41, but it's not clear why. Especially if your forms use classes in them, I noticed some odd behavior. I'll toy around with that and see what happens. |
Great question. I did this because it seemed like the code modules needed to be compiled and saved immediately after import, and code modules may contain early-bound references to forms or reports. (I.e. But you bring up a good point that you can also have the opposite issue, where forms and reports may reference functions and classes that have not yet been imported either. Added to this challenge is that when importing code modules through VBE, (which is needed to support hidden properties) they are created on the VBE side, but do not actually exist in the database till they are saved using One approach which would probably work (although I don't really like it) would be to import the modules twice. First through If we can solve it through the correct sequence of import and save operations, that seems like it would be the ideal solution, but we will just have to do some testing to see what will work across the various scenarios. |
Hmm. I'll toy around with this some. I think the "correct" way to deal with this is to fix late-bound name recall issues that were inherited, and instead use either Of course, this means I have to change things, and I don't like that ;) |
Question: is there a way (that you know of) to detect if a recently VBE imported module is "in" Access, especially after Effectively, I'm looking to hijack the |
You could check the |
|
If we don't specify the active project, we might be compiling and saving the add-in instead of the current database. This can cause the modules not to be listed as Access objects, causing further issues in the build process. This was a major breakthrough in resolving #236
I think the underlying problem here was that you need to ensure that the @hecon5 and @A9G-Data-Droid - Does this resolve the module import issue with your projects? If so, we may be able to keep this simpler approach of exclusively importing modules through VBE rather than having to take the hybrid approach described above. |
Still getting a nag to save modules/classes. Note that this particular version has an error where the code can't compile (due to missing field on a backend table). Since I think this is a decently common occurance, any thoughts on how best to handle this? Best way I think is to not directly call fields on tables that may disappear, obviously, but since this "used" to work* previously, perhaps we should take a different tack?
|
I think this comes down to the following key question: Should we should support the full build of a non-compiling database project?My leaning is that yes, we probably should support this, for a couple reasons.
Based on this, I think we should go ahead and shift to the hybrid approach of using Let me know if anyone has additional input on this, but I think I will start heading that direction... |
I think this is the right approach. While it will cost compile time, I think it will in the end save a huge amount of headache for users that are just starting out, or users that had a buildable version (if not compliable). To me, I often find version control most useful especially when it won't compile, because I can say "hey, this isn't working, can someone else see why" in my dev team. Like I mentioned earlier, I'm at 200+ seconds compile time due to table linking alone, this won't break my stride at all, even if it adds a second or two per module. |
This takes the approach of loading an initial stub as a class or module through LoadFromText so that the object is created on the Access side, then uses VBE to replace the actual code module so that it can support hidden VBE properties. #236
In the most recent update, I took the approach of importing a "stub" module or class to create the object on the database side using |
Will run this through, one moment |
It still has the code to compile and save the modules, so you can feel free to try commenting that out and see how it handles non-compiling code. I didn't have a chance to work through that aspect yet... |
It appears to be significantly improved! Modules saved and I didn't get a prompt. To me, that's acceptable. |
Weird, I did not run into that... |
It relates to some code I am adding that runs |
Does this mean you get an error the first time, but the second it works? |
I think I might have finally figured it out... The
Now I just need to clean things up and remove the test code. I will let you know when this is ready, and you can give it a whirl... |
Reworked the module import to be able to import code that has compile issues, while still saving the code modules. This ended up being more difficult than I expected, but seems to work well now. #236
@hecon5 - Okay, give this a try now. Using the testing database, I was able to import code with a compile error and it fully imported everything. Obviously it couldn't run the AfterBuild function due to the compiler error, but it was able to successfully import all the objects and properties. While it does seem pretty complex for importing code modules, it seems that all of these complexities are necessary to successfully achieve the goal of importing non-compiling code with hidden attributes. For future reference, here are a few notes that I observed while working through this:
|
This appears to work for me, no prompts upon close; opens up fine again. |
It looks like this issue is back when trying to build the add-in from source. (Works fine when building the testing database.) Doing some troubleshooting now to see if I can figure out why we are unable to build the add-in... |
I am now able to successfully build the test database and the add-in from source. Fixes #236
Well, I feel like I have come full circle on some of this, but in my testing this afternoon I made a couple important observations.
This allows us to go back to the simpler approach of importing directly through VBE and saving each object as it is imported. After making these changes I was able to successfully build both the testing database and the add-in. @hecon5 and @A9G-Data-Droid - Would you be able to make sure this works well in your environments? It seems to have resolved the problem for me, but I wanted to double-check before rolling out the public release. 😄 I have attached a copy of the pre-release v3.4.15 just in case you have any issues with older dev builds. |
Will check this shortly. |
Rebuilt ok, far as I can tell, it functioned...and, it didn't prompt me to save anything, either! |
Awesome!! I am thinking we should be pretty much ready to go with pushing out the release then. Thanks again for all your help on the testing side. I feel a lot better with pushing it out after resolving the save-as prompt and non-compiling code issues. This should make the tool much more robust out in production. |
When importing standard and class modules through VBE, the corresponding Access objects are not created until the compile and save command is issued after the build. This causes problems if Access properties relating to these modules are imported at the same time. (Such as a custom object description or hidden flag.)
This can be replicated using the Testing.accdb database, and should be resolved before the 3.4 release.
The text was updated successfully, but these errors were encountered: