By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 916 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Trigger in Access 2000

P: 1
Hallo to everybody, I'm newbie of access 2000, I always used Mysql.
Now I have to make a trigger on a db of access 2000. It should work like this, when I insert a new record in table A the trigger have to insert other prefixed records in table B. How can I insert this trigger in Access 2000?
Thank you very much for your help
FBU
Mar 21 '07 #1
Share this Question
Share on Google+
1 Reply


MMcCarthy
Expert Mod 10K+
P: 14,534
Hallo to everybody, I'm newbie of access 2000, I always used Mysql.
Now I have to make a trigger on a db of access 2000. It should work like this, when I insert a new record in table A the trigger have to insert other prefixed records in table B. How can I insert this trigger in Access 2000?
Thank you very much for your help
FBU
Access doesn't have triggers as such but if you have a form where the new record is being inserted you can code an event. For example on a button click event you can run an INSERT query to add a record to table B.
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnName_Click()
  2. Dim strSQL As String
  3.  
  4.    strSQL = "INSERT INTO TableB ([Field1], [Field2]) " & _
  5.        "VALUES (" & Value1 & ", '" & Value2 & "')"
  6.    DoCmd.RunSQL strSQL
  7.  
  8. End Sub
  9.  
Please note that Value2 is enclosed in single quotes denoting a string.

Mary
Mar 21 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.