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

Edit values in a table 1

Status
Not open for further replies.

BrenoAguiar

IS-IT--Management
Feb 8, 2005
81
0
0
US
How can I edit the value of a specific field in a table through an unbound form. I tried something like that but it didn't work:

Dim subm5 As Recordset
Set subm5 = CurrentDb.OpenRecordset("pur_unit", dbOpenDynaset)
With subm5
.FindFirst "location='" & Me.[location] & "'"
If .NoMatch Then
.AddNew
![quantity] = Me.[quantity]
Else
.Edit
End If
.Edit
![quantity] = ![quantity] + Me.[quantity]
.Update
End With


I'm trying to add (or subtract) what the user types in the unbound form quantity field.
Any help?
 
but it didn't work
Very informative ...
Perhaps something like this ?
Dim subm5 As DAO.Recordset
Set subm5 = CurrentDb.OpenRecordset("pur_unit", dbOpenDynaset)
With subm5
.FindFirst "location='" & Me.[location] & "'"
If .NoMatch Then
.AddNew
![location=] = Me.[location]
![quantity] = 0
Else
.Edit
End If
![quantity] = ![quantity] + Me.[quantity]
.Update
.Close
End With
Set subm5 = Nothing

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry.. forgot to paste the error. But was the [location] missing to ".Addnew". Thanks again PHV!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top