OAC Technology
asked on
Microsoft Access, Running custom code when a row is added in a table.
I have a table with a table relationship to a parent table which is a list of items and checkboxes associated with those items, and want to check the parent table and alert me if I try to select an item from the parent table when a specific checkbox is selected in that item's row. How do I do this?
better upload a copy of your db to avoid too much code posting..
ASKER
I can't upload my database.
oh well, wait for somebody who have a crystal ball to guess what you have in your db.
cap,
<<oh well, wait for somebody who have a crystal ball to guess what you have in your db.>>
That's not a helpful comment.
DataDudes,
Not quite clear on what it is your trying to do exactly. JET/ACE does not have table level triggers unless you use 2010 and a macro.
In general, checking is done in a BeforeUpdate event of a form. This is the event that occurs just before a record is written out. It is a cancelable event, so you can stop the save if something is going on that you don't like.
AfterUpdate occurs after the current record has been saved, and this is your shot to do something accordingly.
If that doesn't get you going, outline in a little more detail what the situation is.
Jim.
<<oh well, wait for somebody who have a crystal ball to guess what you have in your db.>>
That's not a helpful comment.
DataDudes,
Not quite clear on what it is your trying to do exactly. JET/ACE does not have table level triggers unless you use 2010 and a macro.
In general, checking is done in a BeforeUpdate event of a form. This is the event that occurs just before a record is written out. It is a cancelable event, so you can stop the save if something is going on that you don't like.
AfterUpdate occurs after the current record has been saved, and this is your shot to do something accordingly.
If that doesn't get you going, outline in a little more detail what the situation is.
Jim.
ASKER
Ok, I figured out how to make a dialog box pop up in the form, and it cancels properly.
I have a table called "Company", with a column called "Company", and a check box column which is called "ON HOLD". If the "ON HOLD" check box for a Company is selected, I want the dialog box to pop up.
The form I'm working with is linked to a different table, with a relationship to the Company table to get its data.
I have a table called "Company", with a column called "Company", and a check box column which is called "ON HOLD". If the "ON HOLD" check box for a Company is selected, I want the dialog box to pop up.
The form I'm working with is linked to a different table, with a relationship to the Company table to get its data.
<< I want the dialog box to pop up.>>
When?
Jim.
When?
Jim.
ASKER
As soon as a company with the check box checked is selected.
Table 1 looks like this:
-------------------------- -------
|Company | On Hold |
===================
| name | checked |
-------------------------- -------
Table 2 is different, but it references Table 1 to get the Company names. If the check box in Table 1 is checked I want to get the message box. My form created off of Table 2.
Table 1 looks like this:
--------------------------
|Company | On Hold |
===================
| name | checked |
--------------------------
Table 2 is different, but it references Table 1 to get the Company names. If the check box in Table 1 is checked I want to get the message box. My form created off of Table 2.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
One thing that's always good to do when your not sure what event to use is keep a spare form bound to a simple table. In each event, put a STOP, message box, or print to the debug window something like "just hit afterupdate".
Then do the operation your trying to do and look at what you hit or see in the debug window.
Doing that with reports is a real eye opener!
Jim.
Then do the operation your trying to do and look at what you hit or see in the debug window.
Doing that with reports is a real eye opener!
Jim.