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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace Data More Than One Field 1

Status
Not open for further replies.

surfbum3000

Technical User
Aug 22, 2003
156
US
How can I replace multiple values in one field?

UPDATE tblxAppts2Weeks SET ENDTIME = Replace(ENDTIME,"10:59","11:00")

Now I want to add:
Replace(ENDTIME,"14:59","15:00")
Replace(ENDTIME,"13:59","14:00"), etc.
 
Is your field type text or date/time?

Can we assume you want to add one minute to a value if the "minutes" portion of the value is "59"?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Data type = text

Your assumption is correct. If any field has :59 I need to add 1 minute.
 
UPDATE tblxAppts2Weeks
SET ENDTIME = Format(DateAdd('n',1,[ENDTIME]), 'hh:nn')
WHERE ENDTIME Like '*:59'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I would create an update query like:
Code:
UPDATE tblxAppts2Weeks 
SET EndTime =Format(DateAdd("n",1,TimeValue(EndTime)),"hh:nn")
WHERE RIGHT(EndTime,2) = "59";
You might want to test this first with this sql:
Code:
SELECT EndTime, Format(DateAdd("n",1,TimeValue(EndTime)),"hh:nn") As NewEndTime
FROM tblxAppts2Weeks 
WHERE RIGHT(EndTime,2) = "59";



Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top