Access does not have any triggers on tables, so the closest you get (I think), is using form events. You're only allowing the user to enter information through forms, right?
Then - the before update event of the form happens immediately before the save, and you can cancel it, and the after update happens immediately after a save (usable as event for your messagebox?)
I don't see how you can use a trigger in SQL Server to send a message back to your user. Triggers are meant to do something internal in the SQL Server, like update an associated record.
It will need to be on your web app that you display the message that the record was added sucessfully to the database. Generally, you would do that after whatever code adds the record, you can assume if there wasn't an error then it was successful.
What you are after, doesn't seem to relate much to triggers, and is probably how to find out the result of your action. JoeAtWork has one suggestion, then both DAO and ADO have methods to get the number of records affected by an action query (I suppose such exist for ADO.Net too), and using Jet 4.0, you can do "@@select identity" to retrieve the last identity/autonumber. All these questions, however, are probably better answered in a forum dedicated to the technology you're using.
I'm assuming your creating DAP's. Hopefully you have a command button to save the record. If you do, right click the button, select Microsoft Script editor. On the left under Script Outline, scroll down to your button's name. Expand the branch and double click on OnClick. You will write some VB script to open another form with your message. See the following two web sites for help.
The first shows you how to Position your web page in a new window with the message.
This example uses the open method to create a new window that contains Sample.htm. The new window is 200 pixels by 400 pixels and has a status bar, but it does not have a toolbar, menu bar, or address field.
Just to clarify here exactly what I want, although, I think I have found a solution.
I have an assistant in Edinburgh that has the access database. What I am trying to do is that if a person (in Inverness for example) opens up the web front end and raises a work request, that entry is written into the database in Edinburgh.
What I want to achieve then is that the access database recognises that a new entry has been written and informs ths assistant in Edinburgh.
So, I need some sort of trigger that fires when a new record is written. I thought about using a form with a timer checking the number of records in the table every so often but I wondered if there was a better way.
The only way I can think of is for the HTML page to periodically refresh, checking each time for any new records in the database.
One possibility, create a new table that relates users to work requests, to track which work requests the user has acknowledged. On the web page, you could list all requests not yet Acknowledged as links. If the user clicks on the link (presumably sending him to a page with the details of the work request), that would set the Acknowledged flag to True, and thus removing the request from the "new" list the next time the user goes to the home page.
Oh. I get it now. I don't know about a message, but I created one where when a table was updated it also created a log to another table of which record was changed or ADDED, what was change, and at what time. Maybe you could do this and that way the Edinburgh person could then create reports of any changes or additions. Plus you'll have a history table.
I recorded the date and time the record was added to the history (or log) table. Then you can just run a query with date parameters for a daily, weekly, whatever report to see what was added or changed. I don't have an "instant message" appear.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.