Hi,
I have been asked to compare expenditures related to the same client over two years.
I need to create a DialogBox that prompt the user to select the databases and call them to do some grouping and comparison.
I was trying to get inspiration from Brian's youtube video but I got stuck with a sintax error I can't understand.
I attach the ISS file.
As I am still learning how to code I will go with doubling the test on each of them and use a recorded macro to work with DBjoin, comparison and Analytical Review.
Thank you for your help.
VITOPIEPOLI
Offline
Last seen: 2 months 5 days ago
Joined: 10/29/2019 - 11:28
Hi Vitopiepoli,
I updated the script so that you can get two files. I also added comments to the code so you can see what I did.
Brian
Hi Brian,
thank you very much.
I will try now to add the button to run the operation and write the code around it.
As there are 6 or 7 analysis to be done at once, can I call it through another Sub...End Sub that call the relevant functions?
Regards.
Vito
Generally I would create a new function or sub for each test or analysis and then just call it from the main sub, much like IDEA does when it creates a script from the IDEA history.
I though the main sub was "dedicated" to the DialogBox.
I will append the calls to the functions there then and use the Ok Button to run the functions.
Thank you very much for your help.
Nope, the purpose of the main sub is to be the starting point of any script, so the sub is the starting and ending point of your script. So you could do the following:
Sub Main
Call menu
Call Test1
Call Test2
Call Test3
End Sub
So really it is the most important part of your script.
I am almost there...I think.
Oddly enough the functions run only after I quit the dialog. When I click OK nothing happens.
Where the mistake is?
I have found the workaround.
I call the functions after the OKButton1 section rather than the main sub.
Thank you again, you have been very helpful.
Regards,
Actually what you want to do is close the dialog and then run the code. So find this line:
This is also a good solution.
Many thanks for your help.
Regards,
Vito