Need a help for updating many tables !

L

luanhoxung

Hi, All !
I need a thought for hepl !
I have 4 tables related together through a field(ContNo).
But there are some reasons, I use temporary value for recording ContNo
field. After that I want to update the temporary value by new value.
Is there any way to do this fastly ?
I thought about using VBA Openrecordset for each Table and update
ContNo field through a form.
Any ideas to solve this problem ?
Thanks for ur time.
Luan
 
S

Scott McDaniel

Hi, All !
I need a thought for hepl !
I have 4 tables related together through a field(ContNo).
But there are some reasons, I use temporary value for recording ContNo
field. After that I want to update the temporary value by new value.
Is there any way to do this fastly ?
I thought about using VBA Openrecordset for each Table and update
ContNo field through a form.

The fastest way would be straight SQL:

CurrentProject.Connection.Execute "UPDATE YourTable Set ContNo=" & NewValue & " WHERE ContNo=" & OldValue

If ContNo is a Text field, you'd need to surround it with single quotes

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
L

luanhoxung

The fastest way would be straight SQL:

CurrentProject.Connection.Execute "UPDATE YourTable Set ContNo=" & NewValue & " WHERE ContNo=" & OldValue

If ContNo is a Text field, you'd need to surround it with single quotes

Scott McDaniel
scott@takemeout_infotrakker.comwww.infotrakker.com

Hi Scott !
Thanks for ur response !
I think the code you advise just Updating the ContNo of 1 table,
Can I Update 4 tables in 1 code ??
Thanks again.
Luan from VietNam
 
L

luanhoxung

Hi Scott !
Thanks for ur response !
I think the code you advise just Updating the ContNo of 1 table,
Can I Update 4 tables in 1 code ??
Thanks again.
Luan from VietNam- Hide quoted text -

- Show quoted text -

Hi Scott again !
The code works great !
Sorry abt previous posting without checking ! :<
But I have to close the database and reopen it , the ConNo is
updated !?
I use the code in AfterUpdate of NewValue field.
How can I do update the ContNo after I type new value in NewValue ??
Thanks in advance.
Luan from VietNam
 

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