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

Update help

Status
Not open for further replies.

EBee

MIS
Aug 10, 2001
229
US
I am trying to update data in my record and it's not updating. What 'em i doing wrong. .

thanks
erwin


Private Sub Update_data()
Dim db As Database
Dim rs As Recordset


Set db = CurrentDb()
Set rs = db.OpenRecordset("Get_change_tbl")

rs.MoveFirst
Do Until rs.EOF



If rs!Tip >= 20 And rs!Tip < 30 Then
rs.Edit
rs!Get20 = rs!Tip - 20
rs.Update
End If

If rs!Get20 >= 10 And rs!Tip < 20 Then
rs.Edit
rs!Get10 = rs!Get20 - 10
rs.Update
End If

If rs!Get10 >= 5 And rs!Tip < 10 Then
rs.Edit
rs!Get5 = rs!Get10 - 5
rs.Update
End If

If rs!Get1 >= 1 And rs!Tip < 5 Then
rs.Edit
rs!Get1 = rs!Get5 * 1
rs.Update
End If

If rs!Get1 > 1 And rs!Get1 < 0.99 Then
rs.Edit
rs!Get25 = rs!Get1 / 0.25
End If


rs.MoveNext
Loop




MsgBox &quot; Done. . Thank you &quot;


End Sub
 
ebee,
The last .Edit isn't closed with an .Update, also, it's possible that none of the records meet any of the criteria you have.
Another thing (which is most likely not the problem here) would be to specify the recordset type in the Openrecordset call, but if the type that access chose as default wasn't updateable, you'd have seen an error telling you that.
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top