Using flags to control procedure flow

SaviorSix

Registered User.
Local time
Today, 11:15
Joined
Mar 25, 2008
Messages
71
Hello - I am developing a component of my application which performs about a dozen tasks, each task having its own procedure. It roughly flows like this:

1.user chooses excel file to import
2.data from file is imported into a temp table & recordset created for data validation
3.field values are scanned and compared to existing data used for validation
4.values that do not pass validation are shown to user so they can make edits
5.user's changes are applied to the recordset
6.final import of data into permanent table

Im trying to devise a way to control the flow between the dozen or so separate procedures used for this process. I currently have all of the procedures in one standard module, and then a "main" procedure in a form module which just calls each of the separate procedures one at a time.

How can use flags to determine what step in the process I'm at? For example, pausing to accept user input, and then restarting at the correct procedure..
 
Not clear on why you need a flag. If you use an InputBox or a form in dialog mode to gather user input, code will automatically return where it was when the user is done. If wanted a flag for some reason, you could pass it with OpenArgs or set a global variable.
 
This whole import process is controlled by a form, which I have designed as a sort of "wizard," using a tab control which changes tabs at each step in the process.

So tab 1 is step 1, which has a textbox and a "browse" button for the user to select the file. The user clicks "Next," and the first two sub procedures run which imports the data and adds a field or two to the temp table.

Then tab 2 is made visible, and a new set of controls appear for some different user input, and when the user advances from this step, a couple more procedures are run..

and so on and so forth, until the whole process is done.

Now that I'm thinking about it more, I suppose you're right... I don't really need flags. I'm just trying to think of the most efficient way to organize these procedures so they can be run in sequence from a single "master" procedure, rather than calling few procedures when one button is clicked, calling a couple other procedures when another button is clicked...etc
 
Is there a reason one procedure couldn't do it all, perhaps calling others to do parts of it? I can visualize a procedure that ran from beginning to end, popping up forms to gather user input as appropriate. Of course, I don't know everything it's doing.
 
Mostly because the main procedure needs to pause, while one sub procedure that applies user updates can be run any number of times, depending on how many changes the user makes, and once the edits are done, return to the main procedure were it left off...and I'm not using any dialog forms for this, so I can't pause it that way.

main procedure

sub procedure 1

sub procedure 2 <- main proc. pauses, this proc can be run any number of
times (for example it runs an update query on one
record), once done, continue to procedure 3

sub procedure 3

end main procedure
 

Users who are viewing this thread

Back
Top Bottom