I have code that does a dlookup on a table with one row, one field. In my code I add 1 to that number and now I want to write the new number back to the table. How do I do that?
Dim varX As Variant
varX = DLookup("[upccode]", "nextupc", "[upccode] > 1")
'add 1 to that # and write it back
Dim varY As Variant
varY = Val(varX) + 1
Update nextupc SET upccode = varY where upccode = varX
dim strSQL As String
With Currentdb.openrecordset("SELECT upccode FROM nextupc WHERE upccode > 1")
Do Until .EOF
.Edit
.Fields("upccode") = .Fields("upccode") + 1
.Update
Loop
End With
Hope this helps.
-------------------------
Just call me Captain Awesome.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.