Skip to content
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

Import one file #406

Open
santiobarco opened this issue Jun 26, 2023 · 31 comments
Open

Import one file #406

santiobarco opened this issue Jun 26, 2023 · 31 comments
Labels
need more details Further information needed to understand issue

Comments

@santiobarco
Copy link

santiobarco commented Jun 26, 2023

I need update just one file in the application, I have a change in one form, what I need to do?

@joyfullservice
Copy link
Owner

@santiobarco - Great question! There are two approaches you can take in the latest beta version. (Version 4.0.13-beta that I just published today)

From the ribbon, you can click the button to Load Selected. That will reload that item from the source file.

image

The other option is to perform a Merge Build, a newly developed feature which will scan your source files for changes that do not exist in your database, and import any changed source items into the database. (This is typically much faster than rebuilding the entire database from source.)

image

I hope that helps!

@santiobarco
Copy link
Author

Thanks for your faster answer, I have an other question, If I want it to compare the existing files and only change the ones that have changes I can do it too, I try to do a merge because I just added some public sub in one of the existing modules and it tells me that I should build from source first

@joyfullservice
Copy link
Owner

Yes, that would be correct. In order to merge from source, you need to do a full build from source first. Once you have done the initial full build, you can export and merge as often as you like.

@santiobarco
Copy link
Author

Thanks I will try it!!

@santiobarco
Copy link
Author

This does not make a comparison of a file with another, I mean if a new module was created to a new function, etc.

@joyfullservice
Copy link
Owner

@santiobarco - Perhaps I am not quite understanding your question... Let me try to explain what I think you are asking, and you can help me understand.

You have a database, let's call it Database.accdb. You have used this add-in to export the source files to Database.accdb.src. In the source files folder, you have modified one of the existing source files, Module1.bas to include a new VBA function. Now you would like to update Database.accdb to include this new change from Module1.bas.

What you are dealing with here is a change to the source files that you would like reflected in your database. Up till just recently, the way you would do this is to build the database from source. This would reconstruct the database from the source files. After building from source, Database.accdb now includes the new function in Module1.bas.

A new functionality just recently introduced (currently in the dev branch) allows you to merge build, which scans your source files to identify changes that do not currently exist in Database.accdb. During this scan, the add-in would detect that Module1 has changes in the source file that do not match Module1 in the database. Assuming that Module1 in the database has not changed since the last time it was exported, Module1 would be recreated from the source file. Now Database.accdb includes the changes from Module1.bas, without having to perform a full build of the database.
(Note, in order to perform a merge build, you must have done a full build at least once.)

Let me know if this makes the process more clear...

@santiobarco
Copy link
Author

Hi @joyfullservice I need to build from source for merge a new changes, but when start the process for build from source the application stays frozen, do you have some advice for make this please

@joyfullservice
Copy link
Owner

Which version of the add-in are you using? Also, are you able to build other databases from source? (For example, if you create a very simple new database file, can you export that to source files, then build it from source?)

@santiobarco
Copy link
Author

Thanks a lot for the quickly answer I need to solve this now, I use the version 4.0.15-beta and I try to build from source with a simple database and i'ts working with a simple file

@joyfullservice
Copy link
Owner

You could try the build with or without the Debug VBA Errors option to see if that helps identify the problem...

image

When it freezes, are you able to press ctl+break to stop the running code? Can you tell where the build is struggling to continue? What is the last thing you see on the screen before it gets stuck? These clues may help us pinpoint where the problem is occurring.

@santiobarco
Copy link
Author

Ok adam I'll try right now!!

@santiobarco
Copy link
Author

Adam the process is freeze when start the import of the forms

@joyfullservice
Copy link
Owner

Okay, let's try to figure out what is happening with the form import... Here are a couple things you could try:

Using the existing database, try importing the forms one by one using the Load Selected button on the toolbar. This might help us see if it is affect all the forms, or just certain ones. To do this, select the form in the navigation pane, then click the Load Selected button to reload that individual object from the source file.

A second thing you could try is to go to your simple test database, and use Microsoft Access to import the forms from your big database into your test database. After importing the forms, export the test database to source files, and then try building from source. If it still freezes, then remove all the forms from the test database and try just importing one or two of the most simple forms from the big database.

The goal here is to identify a form that is failing to import, then to figure out what might be causing it to fail. You can also add breakpoints in the VBA code for the form import process (see clsDbForm), and step through the code as it performs the import to see if that helps identify exactly where the code is failing.

Let me know what you find out!

@santiobarco
Copy link
Author

I have more than 100 forms import one by one is not a option, I tried again to build from source and press ctrl + break for see the debug vba Errors but this shortcut is not working.

@joyfullservice
Copy link
Owner

Yes, I can feel your pain with that. The main thing I am trying to identify is if the form import issue is related to ALL of the forms, or just some of them. You probably won't need to import all 100 forms one by one. You might just need to test a few of them to find one that exhibits the issue. From there you can drill down and isolate issues until we can figure out exactly what is causing the import to fail.

If you can find ONE form that fails to import, that you can reproduce with your testing database, it will make troubleshooting the problem a lot easier. My guess is that there will be something we can do to resolve the issue, but we just need to figure out what the problem is first. 😄

@santiobarco
Copy link
Author

I got you adam thanks for all the help, but I tried with 10 of that but don't have any problem them. I'll keep trying

@santiobarco
Copy link
Author

santiobarco commented Jul 31, 2023

Ok adam I find the form that have issues, how handle this, I have the name of the form

@santiobarco
Copy link
Author

But I make a mistake and block the add-in for because I made many times frozen the app, how we enable again the vcs add-in

@joyfullservice
Copy link
Owner

If you want to provide a small sample database, I could test it on my system. Otherwise you will need to set some break points in the VBA add-in code to step through the import process.

Regarding the add-in, try reinstalling it and see if that resolves the block. If not, you might need to figure out how to unblock it again first.

@santiobarco
Copy link
Author

Adam thanks for the help, when I tried to add-in the VCS, i get this system message is missinig a USysreginfo table, do you know where I need to create this table?

@joyfullservice
Copy link
Owner

That's for a different kind of installation. This add-in doesn't require that table (or admin privileges to install). Just double-click the downloaded add-in file, and click the button to install when it opens.

@santiobarco
Copy link
Author

santiobarco commented Aug 1, 2023

Adam I Made the installation again, but I can't see the VCS in the ribbon is weird

@joyfullservice
Copy link
Owner

Adam I Made the installation again, but I can't see the VCS in the ribbon is weird

There are two parts to the installation. The Microsoft Access add-in is installed, and available via the ribbon, and via the Add-ins menu. If you can launch the add-in using this menu, you know that the Access add-in is working.

image

The second part of the installation is the COM add-in, which is installed a different way. (Access add-ins are literally Access database files with VBA code, while a COM add-in is a compiled DLL, in this case created with twinBASIC.)

To view/manage the COM add-ins, you navigate to the application options:

image

There you will find the COM add-ins listed, and an option to load/unload or remove.

image

You mentioned that something was "blocked" at some point when you were testing... I don't know which thing was blocked, or exactly how it was blocked. Normally the installation is very simple. One click and you are done. 😄 You may need to go to the COM add-ins and remove the existing item, then run the (Access add-in) installation again to see if the installer will reinstall it for you.

Again, to install/reinstall, simply double-click Version Control.accda and click the Install button. That should handle extracting and installing the COM add-in, registering and activating the ribbon, etc...

Hope that helps!

@santiobarco
Copy link
Author

santiobarco commented Aug 1, 2023

aa

Adam I made the installation again but I can't see the VCS in the ribbon

@joyfullservice
Copy link
Owner

What do you see in the COM Add-in dialogs shown in the screenshots above? The COM add-in is what loads the ribbon. If the COM add-in is not loading, you won't see the ribbon.

@santiobarco
Copy link
Author

image Adam I can see the ribbon thanks a lot I'll still investigate the form that have the problem, thanks a lot for them, when I got some news about the form I'll keep in post to you

@joyfullservice joyfullservice added the need more details Further information needed to understand issue label Aug 9, 2023
@sotalvaro
Copy link

sotalvaro commented Sep 5, 2023

Hi Adam, can you guide me when you executes the Build as button I need execute a routine and integrate internally all this flow, but I need to overwrite always with the same name of the original version, just need to build the new app with the same original name and overwrite, for don't create more copies inside the folder.

How can I modify the code? I need make the Build As routine will execute when is determine user.

Another question @joyfullservice why when I just open the access file I'm unable to see the vba code of VCS.
image

Thanks for your help man.

@joyfullservice
Copy link
Owner

There are two types of add-ins that work together for this. The COM add-in is what contains the ribbon commands, and is loaded when you open Microsoft Access. This stays loaded all the time. (This is developed in twinBASIC and installed as a compiled DLL.)

The Access add-in is a Microsoft Access database project that contains the main logic for exporting source files and building a database from source. Unlike the COM add-in which is loaded all the time, this add-in is loaded on demand when it is first used. After the Access add-in is loaded, it stays loaded until the application is closed.

The reason you don't see the MSAccessVCS project in the screenshot above is because it has not yet been loaded in this instance of Access. When you click one of the VCS ribbon commands, the Access add-in will be automatically loaded, and you will see it listed in the VBA projects list. The internal Access wizards work the same way. Once you run a wizard, that add-in stays loaded in Microsoft Access until the application is closed.

To find the code that is executed when you click a button on the ribbon, take a look at the clsVersionControl class module. There you can find the BuildAs() function, and see exactly what the code is doing.

You mentioned needing to execute a routine and internally integrate this workflow. I am not sure that I completely understand what you are wanting to do, but here are a couple things that may be helpful:

  • This add-in includes some "hooks" to execute code in your own database at various points in the export and build process. Using these hooks, you can automate a lot of internal processes such as cleanup and build verification.
  • If you are wanting to externally automate the build process itself, this is something that is not yet fully developed at this point.

I need to overwrite always with the same name of the original version, just need to build the new app with the same original name and overwrite, for don't create more copies inside the folder.

A normal build does exactly that, replacing the existing database with a freshly built version. The "copies" in the folder are backups of the database before each build. If you really don't want the backup files, you can add some code to delete the backups and trigger it to run after the build process.

Hope that helps!

@sotalvaro
Copy link

Hi Adam Thanks for the quickly answer, here is the thing that I need to do, I need to run the build as process automatically, because I set up a pipeline in azure dev ops and the release open the access file, when the access file is open I need to validate the user that is open the file (The user of the pipeline of azure dev ops) after that I need to, run the build as process always in the same path and overwrite the file with the same name.

joyfullservice added a commit that referenced this issue Sep 6, 2023
Using the InteractionMode property, you can perform a silent build operation. This can now be used with an automated build process as part of a CI workflow. #406
@joyfullservice
Copy link
Owner

As of the latest commit, you should have everything you need to do this, but you will obviously need to work through the specifics in your particular build process. To launch the add-in and initiate actions, please see ExampleLoadAddInAndRunExport() in modAPI. The specific commands you will want to run are:

MSAccessVCS.SetInteractionMode 1   ' Set to silent
MSAccessVCS.HandleRibbonCommand "btnBuild"

This will run the same action as clicking the "Build From Source" button on the ribbon toolbar. (To build the current database from source.)

I would highly recommend using the standard build operation, not the Build As for automated builds. You can check out the project to a build folder in your deployment pipeline, and then after building from source, you can test/verify your file, then push it out to whatever distribution system you have set up. You may also want to add some automated checks to review the build log file to check for any errors.

If you have further questions/issues with the build automation, please feel free to open a new issue for that. I think we have pretty well resolved the original issue of importing one file. 😄

I am planning to roll out a new dev release today (4.0.21), so that should include all of the latest commits needed to perform an automated build.

@sotalvaro
Copy link

sotalvaro commented Sep 6, 2023

Adam Thanks for the answer. If I need to execute the same routine that you post in there I can see the in the same method? but i need to change just this MSAccessVCS.Exportsource for what word man.
image

Just need to change right this
image

And i'll create the new issue hehe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need more details Further information needed to understand issue
Projects
None yet
Development

No branches or pull requests

3 participants