update field automatic !!!!!!

Hany Freedom

Registered User.
Local time
Today, 03:38
Joined
Nov 10, 2007
Messages
30
I don't now how to update field automatic when new record in another table entered.

I now I suppose to use update query by SQL language when I want to make that , but I can't configure the query.

I want any example for that problem .
 
you're an ocp and you don't know how to write an update statement?
you're pulling my leg!
 
Jet does not support triggers if that is what you are looking for. Keep in mind that storing data in multiple places violates proper normalization.
 
you're an ocp and you don't know how to write an update statement?
you're pulling my leg!
yes ..... that's normal , you can make great things by what are you professional at it ..... I hope your leg breakup , then you will not hurt from it ..... hahaha
 
plzzzzzzz

I want simple example from anyone that help me to update some filed when new record entered in another table.
 
Hany,

As Pat said, Access does not support triggers. There are no table-driven events.

From a form, you can use the AfterInsert event. After the insert into your "main"
table you can run code:

Code:
DoCmd.RunSQL "Update YourOtherTable " & _
             "Set    SomeField = " & Me.FieldOnYourMainForm & " " & _
             "Where  YourOtherTablePK = " & Me.MainFormPK & ";"

If that isn't what you meant please don't breakup my leg,
Wayne
 
hahaha , no relax , I most probably will not hurt you , but please , I hope you make simple database - just little simple DB - and put your code in it.
because I can't configure the code completely with my DB , or by accurate meaning I don't understand the code without some example with it , and thanks a lot Wayne
 
Hany,

It's just one line of code!

Have you ever dealt with VBA or any of the Access form events?
If not, look at any of the DBs in the Sample Database section here.

Just swap in your table names and field names. If you have trouble
with that, YOU can post your DB here. It will make it much easier
in the long run.

Code:
DoCmd.RunSQL "Update YourOtherTable " & _
             "Set    SomeField = " & Me.FieldOnYourMainForm & " " & _
             "Where  YourOtherTablePK = " & Me.MainFormPK & ";"

hth,
Wayne
 
in matter of fact , I didn't deal with VBA at all , and my DB wrote into Arabic language , so I don't expect anyone understand it .

but anyway I make quick DB talk about I want , what I want to execute here that I get automatic total value of "invoice" field in "sales" table , that's when I write ( or chosse , I will make company table later) the company name from "today" table , then put the total value in the "invoice" field in "today" table.

and thanks in advance
 

Attachments

There is no easy way to do this in Access because Access is a relational database just as Oracle is. It is better to not store calculated values at all. You can calculate the total value of a sale at any time by using a totals query or in a report by using the Sum() function in the report or section footer.
 

Users who are viewing this thread

Back
Top Bottom