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

Incrementing value on update problem

Status
Not open for further replies.

Microbe

Programmer
Oct 16, 2000
607
AU
I am updating a table in Access. I have a "counter" that keeps track of a condition.

When I use the following SQL statement:

strSQL = "UPDATE Users SET "
strSQL = strSQL & " user_AccessLevel_ID = 4 "
strSQL = strSQL & ", user_numberofProfiles = " & (user.fields.item("user_numberofProfiles").value + 1)
strSQL = strSQL & " WHERE "
strSQL = strSQL & " User_Login ='" & session("user_Login") & "'"

it works fine if the initial value is 0 (zero), incrementing user_numberofProfiles to 1, but from then on, although it updates other fields, no go on the numberofProfiles.

I know it is something wrong with - user.fields.item("user_numberofProfiles").value - but it looks fine.

Any ideas?

Thanks in advance

Steve Davis
hey.you@hahaha.com.au
 
addendum...

Actually the increment from 0 to 1 only works if I have
strSQL = strSQL & ", user_numberofProfiles = " & user_numberofProfiles + 1

But that doesn't look right because it isn't actually getting the field value. But why does it change the value if it is zero?

...puzzled...

Steve Davis
hey.you@hahaha.com.au
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top