Update query help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I have an update query that updates two table fields by 0.83 . One
called DT REGULAR and the other EMPLOYEE TIME. My question is that the query
works but I want to narow down the updates to only rows that have 7.17 for
the EMPLOYEE TIME. What would I use for the criteria? Thanks!!

UPDATE tblMain SET tblMain.[DT REGULAR] = [DT Regular]+0.83,
tblMain.[EMPLOYEE TIME] = [EMPLOYEE TIME]+0.83;
 
Hello, I have an update query that updates two table fields by 0.83 . One
called DT REGULAR and the other EMPLOYEE TIME. My question is that the query
works but I want to narow down the updates to only rows that have 7.17 for
the EMPLOYEE TIME. What would I use for the criteria? Thanks!!

UPDATE tblMain SET tblMain.[DT REGULAR] = [DT Regular]+0.83,
tblMain.[EMPLOYEE TIME] = [EMPLOYEE TIME]+0.83;

UPDATE tblMain SET tblMain.[DT REGULAR] = [DT Regular]+0.83,
tblMain.[EMPLOYEE TIME] = [EMPLOYEE TIME]+0.83
Where tblMain.[Employee Time] = 7.17;
 
Does that mean I just put 7.17 in the criteria? I only know how to copy the
SQL not read it... I put what you fixed and then looked at it in design view
and thats what it did. Is that right?

Thanks
Chad

fredg said:
Hello, I have an update query that updates two table fields by 0.83 . One
called DT REGULAR and the other EMPLOYEE TIME. My question is that the query
works but I want to narow down the updates to only rows that have 7.17 for
the EMPLOYEE TIME. What would I use for the criteria? Thanks!!

UPDATE tblMain SET tblMain.[DT REGULAR] = [DT Regular]+0.83,
tblMain.[EMPLOYEE TIME] = [EMPLOYEE TIME]+0.83;

UPDATE tblMain SET tblMain.[DT REGULAR] = [DT Regular]+0.83,
tblMain.[EMPLOYEE TIME] = [EMPLOYEE TIME]+0.83
Where tblMain.[Employee Time] = 7.17;
 
Yes that is correct.

BUT instead of adding .83 to 7.17 you could just update the value to 8

Field: DT Regular
Update To: 8
Criteria: 7.17

Usual advice, back up your data first and then run the Update query. Once
you change records with an update query the only way to undo is to use the
backup.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Chad said:
Does that mean I just put 7.17 in the criteria? I only know how to copy
the
SQL not read it... I put what you fixed and then looked at it in design
view
and thats what it did. Is that right?

Thanks
Chad

fredg said:
Hello, I have an update query that updates two table fields by 0.83 .
One
called DT REGULAR and the other EMPLOYEE TIME. My question is that the
query
works but I want to narow down the updates to only rows that have 7.17
for
the EMPLOYEE TIME. What would I use for the criteria? Thanks!!

UPDATE tblMain SET tblMain.[DT REGULAR] = [DT Regular]+0.83,
tblMain.[EMPLOYEE TIME] = [EMPLOYEE TIME]+0.83;

UPDATE tblMain SET tblMain.[DT REGULAR] = [DT Regular]+0.83,
tblMain.[EMPLOYEE TIME] = [EMPLOYEE TIME]+0.83
Where tblMain.[Employee Time] = 7.17;
 
Back
Top