Results 1 to 15 of 15
  1. #1
    Join Date
    Feb 2005
    Posts
    17

    Lightbulb Unanswered: Trigger that runs an macro Access

    Hi,

    can I run a macro Access from a trigger ?

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    I suppose you could use xp_cmdshell to open access and run your macro but it sound like a bad idea. What happens if you have a 10000 row insert on the table you have this trigger on. you will have 10000 instances of access open running the same macro. Why not just incorporate the functionality of your macro into your trigger?
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Feb 2005
    Posts
    17
    I'll never have the case of multiple adding or update
    'cause we've got to save data one-by-one.

    1) Button-Click > Save Data
    2) After Save > Run trigger
    3) Trigger > Launch Macro Access
    4) Macro Access > Print formated Data

    I do not know how to format the data without using Access...

    I'm gonna see if xp_cmdshell exists in Oracle
    (never get answers in the Oracle forum)...

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    How can I start a thermonuclear reaction with a flashlight?

    Why don't you explain what you actually need to do, and I promise we can find you a solution...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Quote Originally Posted by Thrasymachus
    I suppose you could use xp_cmdshell to open access and run your macro but it sound like a bad idea. What happens if you have a 10000 row insert on the table you have this trigger on. you will have 10000 instances of access open running the same macro. Why not just incorporate the functionality of your macro into your trigger?
    A 10,000 row insert will still only fire the trigger once...
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  6. #6
    Join Date
    Feb 2005
    Posts
    17
    First of all : Hello again Brett...
    remember the Sybase-SQLServer migration from France...
    Yep that's the come back of Karolyn the Clumsy Guru !

    I've always got particular things to do...

    The boss bought an application that runs on a Oracle database.
    We need to print id-barcodes-stickers for each new article entered.
    But the application doesn't do this, it only saves the data into db.

    So I've linked tables in Access, done a query,
    done a "Etat" (in French in the text) and done a macro
    that will print the formated data from the "Etat".

    Now I want to create a trigger in the Oracle Db of the application.

    So on the click of the Save-Button in the application will insert
    and launch my trigger that will print
    "une merveilleuse étiquette de code à barres" (in French in the text)

    Caroline

  7. #7
    Join Date
    Feb 2005
    Posts
    17
    And Blindman is always right !

  8. #8
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Glad to hear you say that, so I gotta advise you not to do this.

    I just don't think printing of barcodes should be automated by a trigger. It would be more appropriate to have an interface (such as Access) that will print barcodes on command, or perhaps a batch job that runs on a regular schedule and prints barcodes for new or updated records.

    You would just need to add a boolean field to your table that would indicate whether a barcode had been generated for the record yet. It would default to "No" (zero, or whatever...) and your printing procedure woud update it to "True".
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  9. #9
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Goota go with the blind dude from O Hi Yo

    Why does the "bar code" need to be printed at entry?

    Why can't you print the in mass...like in an overnight batch process.

    If, for example, you do print them at entry, who's gonna collect them and what are you gonna do with them?

    Are they lables? Does anything else get produced at entry?

    And here's the big one...does the boss want this done this way?

    And is that you Karolyn?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  10. #10
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    whoops. my bad. gotten again. i avoid using them. most of the time it just seems if you need to populate another table based on what happens to a table, why not just build that logic into your original procedure. the only time i use them is when i have to workaround other people's stuff and I do noot want to change it for whatever reason.

    still learning. still studying every day.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  11. #11
    Join Date
    Feb 2005
    Posts
    17
    This is the easy way...
    but the users are worried about forgetting to print stickers
    and it doubles their work

    SAVE -> LAUNCH exe to print
    instead of just
    SAVE

    and they print barcodes we they update the article
    so the boolean doesn't work

  12. #12
    Join Date
    Feb 2005
    Posts
    17
    Yes they are labels (forgot that word that's why I was using Sticker)

    The users work this way
    The truck comes in
    They unload the block of paper
    They place the block of paper
    For each block of papers
    They enter the info on the first received papers > get the label
    Then they go stick their labels on the block of papers


    (Hint : I now work in a "Imprimerie de livres" (in French in the text))

  13. #13
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Build the barcode printing command into the same process that saves the new record, but don't build it as part of the database structure (trigger).
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  14. #14
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'm definitely with the Blindman on this issue.

    Your workstation knows a great deal more about it's environment than the database ought to know... When you upgrade the workstation to the fancy "wearable computer", triggering a macro remotely could be awkward (you never know where those labels might pop out!). When the next generation of telepathic interface comes into vogue, I'd be really annoyed with a remote computer trying to trigger an Access Macro inside my head!

    On a slightly more serious note, what is done by or at the workstation ought to be controlled by the workstation. It should communicate with the database, but both the client and the server need to retain control of their own environment/hardware... Otherwise the system gets very messy, very quickly.

    -PatP

  15. #15
    Join Date
    Feb 2005
    Posts
    17
    Quote Originally Posted by blindman
    Build the barcode printing command into the same process that saves the new record, but don't build it as part of the database structure (trigger).

    I don't have access to the code of the program (it's a "progiciel")
    it only gives access to it's the database.
    That's why I've got to play with triggers to add the printing functionnality.

Posting Permissions

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