Update query help

C

Chad

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;
 
F

fredg

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;
 
C

Chad

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;
 
J

John Spencer

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;
 

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

Similar Threads


Top