You're missing the point.
There is no way in Access to guarantee that code is automatically run when
you insert data into a table. Sure, you can run any code you want in your
application, but remember that anyone can link to your database and insert
data into your table without using your interface, thereby bypassing
whatever code you want run. Yes, you can check after the fact and run your
code, but if it was to prevent specific data from being entered, or to
ensure that additional data was inserted into another table, your code may
be too late to be effective.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
JIMMIE WHITAKER said:
Actually there is, by runing a function if the id number or whatever indexed
number is larger. Some before update and after update takes care of this.
You just need the if or case statements to decide what to do. A trigger is
nothing more than a flag. I have some on delete code that cleans up linked
tables. If you can say true or false, you can write code to do something
based on an action. I wish these modern people would quit coming up
with
so
many new buzz words. A trigger is nothing more than :
If myflag = 0 then put your hands on your head
OR
If myflag = 0 call myfunctiondeletethedangrecord
OR
just about anything you want if this flag you set up is 0.
heck, you could send a rocket to the moon in code if this flag is 0.
WHATEVER.
Douglas J. Steele said:
While you're right that a trigger is just code, triggers run automatically
when you insert data into a table, for instance. There's no way to
make
code
run automatically in Access when you insert data into a table.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
in code, you can write statements that can duplicate "triggers". triggers
is just a term. No different that using query grid verses writing a sql
statement in vb code.
S.L.,
I was taling about Access as an MDB file. A Trigger
feature in Access would be a great enhancement - maybe
some day .... Thanks for your input.
B.
-----Original Message-----
Are you talking about an Access database, with a MDB
file, or about Access
as a Front-End with SQL-Server as the Back-End?
In the first case, the answer is no and for the second,
there is no
difference on the SQL-Server side about triggers when
Access is used as the
FE.
S. L.
Friends,
In SQL Server, I can set a Trigger that will
automatically
respond to data inserted into Table_A,[Field_1] by
inserting that same data into Table_B,[Field_1].
Is there any way to accomplish this same effect in
Access,
independent of forms/reports (and Code-Behind-Forms)?
Thanks,
Bill
.