Hi All,

I have a access database with these columns. USER_ID,COUNT,TIMES

Let say the current record is this:


Now I want to updated the current count record and times, but before updating I want the old record to be added to the new record. What should be my query?

Recommended Answers

All 6 Replies

first there shud be an insert query to move ur records to the other table and then an update query

eg.insert into newtablename(col1, col2, col3) select col1,col2,col3 from oldtablename

and then an update query based on userid

update oldtablename set count=value1,times=value2 where user_id="STEVE20"

hope it helps u

hi poojav,

thanks for the reply, yes I already knew that, what I am asking is that for example:

From the record from the starting post,

the new record to be inserted is this:

the old record is this:

The updated record will be:

Hope you got it.

how about label help? i mean.. get the old value and add that to a label.
example : label 1 for count, and label 2 for times

after that, on insert query just sum it

set count=value1 + '" & label1.Text & "',times=value2 + '" & label2.Text & "' where user_id="STEVE20"

and hide that label, so user can't see it :D

yes thanks artemix22, i just thought there's a simple query for that.

There is

UPDATE table SET column2 = column2 + 1

yes this is what i'm looking for.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.