Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Run Procedures from a table of procedures? (Office 2000 Sr1a)

    This may sound weird but I want to be able to run a sequence of sub or function procedures that are listed in a table of "actions" by adding commands to a table of commands linked to the actions table.
    For example, say you have an Access table with three actions such as:
    1. Print merge letters
    2. Email such and such.
    3. Publish website.
    all of which are currently achieved by clicking Command buttons 1,2 and 3 respectively (on a certain form in my database) to each of which I have attached the necessary code to the OnClick event for the respective button.
    (The three procedures have names like
    Print_Merge_Letters_Click() ETC.)
    What I do is add an new record to the commands table
    which lists one or more of these actions and mark the command record added as "not yet carried out".
    I would then use (say) the timer event or some other trigger that would periodically check the commands table to see if there are any uncarried out commands.
    If so then for each uncarried out command it would consult the actions table and then somehow trigger
    the associated sub procedure instead of an actual person having to click on the associated command button beforementioned.
    But I don't know how to call the procedure or what would call the procedure.
    The ultimate idea is to be able to update my database remotely on the web using Active Server pages in such a way that I can cause certain things to happen back at the office without being physically present to click on the command buttons on the form.
    Sorry, I know this sounds horribly tortuous.
    So, is there a way to call up a procedure as described above?
    And/or is there a way to use ASP to do things other than add, update or delete records via the web in a remote database. ie. can ASP be used to call a procedure directly in the database?
    Thanks for putting up with this long winded explanation and any ideas much appreciated!

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Run Procedures from a table of procedures? (Office 2000 Sr1a)

    You're reinventing batch processing?

    You already have the names of procedures in a table and you want to add more procedure names? How are you going to keep them from being added twice? Instead of "marking" the records, you could delete them from the table once they're carried out, although it isn't clear exactly what you're doing so that may not be possible.

    You can use Eval(strProcName) to run the procedure, but I think you'll have to use public functions as the procedures. It isn't really very good programming practice to call button clicks from somewhere else anyhow. It's a better idea to call a public routine from both the button click and anywhere else you might need to call the code.

    Someone else will have to comment on the ASP question.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run Procedures from a table of procedures? (Office 2000 Sr1a)

    I KNEW people would laugh at this idea!
    Put simply, I use my Front end Access database to both enter and process data as well as accomplish practical tasks such as printing certain letters, sending certain emails, maybe ring a bell in the front office even.
    I want to do these things from an internet cafe in Italy, Spain or wherever my business leads me. I need a web based front end because internet cafes don't usually offer connection points for laptops which could otherwise perform the task via pcAnywhere.
    They stare at you when you ask for a direct connection because they assume the whole reason anyone would want to use the internet is to send yet another missive via Hotmail back home. Try explaining all this in Spanish and you'll see what I mean!
    So I need a web based front end to my usual home database. But all the information I can find on how to do this points to ASP as the best available means. But I don't see anyone discussing the ASP method for clicking a button on a form.
    I find this amazing!
    So, the idea was to use ASP to add records to a table of which in turn calls on a table of preset routines that would otherwise be called up by clicking on a button.
    Something so basic should be easily possible, wouldn't you think?
    But thanks anyway for the suggestions -will try them out.

  4. #4
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run Procedures from a table of procedures? (Office 2000 Sr1a)

    Would something like this help you out? create a form on your home application with a timer that ran periodically. The timer would open a recordset on a trigger table, and walk thru the records, reading a field called "action". Use the value of "action" in a Select Case statement to run your preconfigured actions. Clear all the records in the trigger table at the end of the loop.

    maybe even include additional fields in the trigger table to allow you to pass parameters to your actions.

    Only thing left to do is to use ASP to add new items into the trigger table. Should not be hard with ASP although I haven't done it myself... [img]/forums/images/smilies/sad.gif[/img] This wouldn't allow you to create new actions remotely -- only to execute those which already exist in the database.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run Procedures from a table of procedures? (Office 2000 Sr1a)

    Thanks, all good ideas. I was thinking along the same lines myself (using the Timer and Select case features). Basically you're right , and Charlotte's suggestion of using the Eval(strProcName) works and saves you using Select Case. By adding new functions to the Actions table with corresponding Public Functions in a special module, I can expand the repertoire of Actions without having to rewrite my Timer subroutine to include more Case statements. You just use a loop until the recordset raised on the trigger table is empty. Also, using ASP to add new items to the trigger table means basically all my treasured actions can be carried out (and incidently logged) with an ASP based website serving as a Front end.
    Can't understand why everyone isn't doing this unless there is some more elegant solution in ASP.
    You can leave your laptop at home!
    PS as well as the Timer method to trigger the checking routine I thought of doing it via Automation with Outlook, using the new mail event as the trigger.
    That way Outlook can be left open and not Access which might compromise security.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •