Skip to main content

Userform with dropdown listboxes

Hi Brian,
 
Can you maybe help me with this script? In order to prevent a script crashing because of varying field names, I would like to create a script that runs based on pre-identified field names that the user selects with dropdown listboxes. I managed to steal some from the scripts you placed on this site, but I'm stuck after the first listbox. 
 
I want to create a summary that shows all the Journal entries in the "memo" journal. To do this, the user first has to select the field that contains the available journals and store this as a string called "Journals". When this has been selected, I would like the second listbox to contain the available journals in "Journals" and store the selected journal in a string called "memo". The third box should contain the entry numbers to summarize on (ans store it as string "Entry", but I guess the routine to fill this listbox would be the same as for listbox 1).
 
Then I would like the code to create a pivot table, with a pagefield set to filter on "memo",  summarizing the accounts on "entry".  Can you maybe whow me how to do this? If I get the general idea on how make the contents of listbox 2 depend on the selection in listbox 1, and use these selections throughout the script, this would be a huge help.
 
My "work in progress" script is added in the attachment. 
 
Thanks a lot in advance!

oyarzabalyago Wed, 02/26/2020 - 14:40

In reply to by Brian Element

 
Thank you very much for the prompt response, I will review everything, and if it does not work, I will send you the capture of the points you told me. regards

oyarzabalyago Thu, 03/05/2020 - 14:56

 
I know you will see things that you don't like in the code, but I pass it to you so you can see what the possible error is causing the bug, thanks Brian

Brian Element Mon, 03/09/2020 - 20:04

In reply to by oyarzabalyago

Here you go, I fixed a few of the problems.  The big one that was causing you a syntax error was in your dialog the dropdown the attached list was blank, it can't be blank, there always needs to be an array variable even if you don't use it, so I updated that.  I updated a bit of code so you can pick your files and such.  Hopefully this will help you out.