Equivalent to a SQL Trigger in Access ???

D

Dwayne Conyers

We would like to implement something like a trigger... when either of two
columns are updated, a third column is updated with the concatenated value
of the other two columns.

So, if column "A" is edited by the user as "Teddy" and column "B" is edited
by the user as "Roosevelt" column "C" will be updated to contain (with an
added space) "Teddy Roosevelt."

In SQL, we can create a trigger on the table to do that. How would this be
implemented in Access?

Thanks in advance!
 
D

Dwayne Conyers

I actually need to use this in a combo box, and would rather have a "clean"
string than have two fields appear in the drop-down control. The combo box
will update a hidden field containing an integer (the integer of the
selected item). That is why we need the concatenation.
 
J

Joe Fallon

In addition to the other responses:
Access .mdb files do NOT support triggers.
(Access .adp files do since they are linked to SQL Server.)

In an .mdb you have to froce theuser to *always* use your UI and *never* let
them run directly against a Table or Query. The Form events can simulate
triggers.
 
T

Tim Ferguson

SELECT MyTable.id, [fname]+" "+[lname] AS FullName FROM MyTable;

Ampersands are a little bit safer than plusses here, as a NULL in one of
the fields will propagate to the whole string.

NULL + "Something" = NULL

NULL & "Something" = "Something"

B Wishes


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top