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

Need to update the table with new values

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
CA
Hi

i have a simple question
i need a sql statement that will replace all '950' to '1' and all '957' to 2 in my Model column of the BlackBerry table.
Please advise the code

Thanks
 
I would just open the recordset and pass thru changing where necessary.

rollie@bwsys.net
 
UPDATE BlackBerry SET Model = '1' where Model = '950';

then...

UPDATE BlackBerry SET Model = '2' where Model = '957';

I don't believe it can be done in one SQL statement, unless you wanted to go VBA...

Set dbsThis=currentdb
Set rstBerry = dbsThis.OpenRecordset("BlackBerry")
With rstBerry
Do Until .EOF
Select Case .Fields("Model")
Case Is '950'
.Edit
.Fields("Model")=1
.Update
Case Is '957'
.Edit
.Fields("Model")=2
.Update
End Select
.Movenext
Loop
End With

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top