Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Oct 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Triggering some code (Access 2003)

    Hi,
    I'm pretty new to working with Access, but I have an Access .mdp database that will continously be updated and new records are inserting from other applications. I need to execute some code everytime a record is added. Does anyone know that best way to accomplish this? Is it possible? I was reading about triggers, but I couldn't find a way to do that with a .mdp file. Any help would be very appreciated.
    thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Triggering some code (Access 2003)

    Welcome to Woody's Lounge.

    The normal extension for an Access database is .mdb, the extension .mdp is used for databases (in Access format) created from and used by Microsoft Project.

    Access does not have triggers at the table level. If a record is being added in a form, you can use the Before Update and/or After Update event of the form to execute code. When data are imported from other applications, it depends on how this is being done. If the import is initiated from a form, you can run code after the import, but if the code is pushed to the database from another application, there is no mechanism in Access to react to that.

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

    Re: Triggering some code (Access 2003)

    <img src=/S/hmmn.gif border=0 alt=hmmn width=15 height=15> Access has mdb and adp files or compiled mde and ade files, but anything else is not a regular Access database. The only place you would be able to use triggers would be in an adp/ade which is a front end for SQL Server ... unless you are thinking of smart tags or something like that.
    Charlotte

  4. #4
    New Lounger
    Join Date
    Oct 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Triggering some code (Access 2003)

    I'm sorry, I sdo have a .mdb file. The file gets updated from other applications opening and writing to the .mdb file. And there is no forms used with this application. Is there no way for accomplishing finding out what new records were added to the file and executing some cose? what are smart tags??

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Triggering some code (Access 2003)

    As I mentioned in my previous reply, Access does not have triggers at the table level, so you can't execute code when other applications add records to a table. If the table contains a date/time field that is either populated by the application, or whose default value is the current date/time, you could run code periodically that checks this field to see which records have been added since the previous time the code was run. You'd store the date/time that the code is run in a separate table.

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

    Re: Triggering some code (Access 2003)

    I don't use 2003 so I can't point you to the specifics in help but here's a link to Office Online about Smart Tags. These do not work at the table level either, only form and datasheet.
    Charlotte

Posting Permissions

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