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

UPDATE SQL

Status
Not open for further replies.

abacus9

Programmer
Joined
Jan 14, 2000
Messages
4
Location
US
I cannot get the update to work. I have tried several different entries but I cannot get the table to be updated to fld. What am I doing wrong?<br>
<br>
Thanks<br>
<br>
Dim db As DATABASE, rs As Recordset, fld As String, strsql As String<br>
Set db = CurrentDb<br>
Set rs = db.OpenRecordset(&quot;ESP_NAMES&quot;)<br>
With rs<br>
rs.MoveLast<br>
rs.MoveFirst<br>
Do Until .EOF<br>
fld = rs.Fields(&quot;TO_ESP_TICKER_ID&quot;)<br>
DoCmd.RunSQL &quot;update esp_name set esp_name = &quot; & fld & &quot; ; &quot;
 
Well first of all Drop the SQL part out of it<br>
Try this instead<br>
<br>
Dim db As Database, rs As Recordset<br>
Set db = CurrentDb<br>
Set rs = db.OpenRecordset(&quot;ESP_NAMES&quot;)<br>
rs.MoveLast<br>
rs.MoveFirst<br>
Do Until rs.EOF<br>
rs.Edit<br>
fld = rs.Fields(&quot;TO_ESP_TICKER_ID&quot;)<br>
rs.Update<br>
rs.movenext<br>
Loop<br>
rs.Close<br>
db.Close<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top