Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Query Question

Status
Not open for further replies.

Greg25

Technical User
May 30, 2001
159
US
can an if statment be added to a update query
if so where and how will this be placed

[last_cost_center_code], if = 5
[closed_job] then = 1
[closed_date] then = Date()


SQL

UPDATE
[Status change export] INNER JOIN [status change]

ON

[Status change export].job_number = [status change].job_number

SET

[status change].job_number = [Status change export]![job_number],
[status change].last_cost_center_code = [Status change export]![last_cost_center_code],
[status change].last_valid_index = [Status change export]![last_valid_index]+1,
[status change].vt_status_date = Date(),
[status change].closed_job = [Status change export]![closed_job],
[status change].closed_date = [Status change export]![closed_date]; Greg

K & G Design
kgdesign@warwick.net

 
I will submitt what i have done and
what i found that worked for me

UPDATE [Status change export] INNER JOIN [status change]
ON [Status change export].job_number = [status change].job_number
SET [status change].job_number = [Status change export]![job_number],
[status change].last_cost_center_code = [Status change export]![last_cost_center_code],
[status change].last_valid_index = [Status change export]![last_valid_index]+1,
[status change].vt_status_date = Date(),
[status change].closed_job = IIf([Status change export]![last_cost_center_code]=5,1,0),
[status change].closed_date = IIf([Status change export]![last_cost_center_code]=5,Date());
Greg

K & G Design
kgdesign@warwick.net

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top