update a column with its last value and concat to the value of another column

mana

Registered User.
Local time
Yesterday, 20:54
Joined
Nov 4, 2014
Messages
265
hello

i have the following code but it doesn't work can you help me please?
thank you

DoCmd.RunSQL (" update tbl_userinformation SET [05-Henrichpiramid] = Yes where Username= Text146.value AND actualdate=Text148.value ;")
DoCmd.RunSQL (" update tbl_userinformation SET [combination] = [05-Henrichpiramid] where Username= Text146.value AND actualdate=Text148.value ;")

i want to update the column combination to its last value with concatanation to the value of current column . can you help me please?
thank you
 
it would be REALLY HELPFUL if you explain what you mean by 'it doesn't work '. Do you get an error? if so, what is the error description? The code runs, but records are not updated or what?

This is not your first post and if you review all your threads you will see that you provide very little information which results in others asking lots of the same questions as above. By now you should have got the idea that providing some basic background information saves time. We provide our time for free, so stop wasting it or you will find that people will stop trying to help
 
hello

sorry for short description
i changed the code as below

DoCmd.RunSQL (" update tbl_userinformation " & _
"SET [combination] =
& "05-Henrichpiramid" & " & _
"where [Username]= Text146.value AND actualdate=Text148.value ;")


i have the error as syntax error.
I want to update a column that has a value with a new value plus its previous value
for example the value of my current column is mn and the value of another column is xy now i want to have mn,xy in current my column. my current column here is combination. but i don't know how to do this?
i hope the information could be clear and enough.
& "05-Henrichpiramid" & " is just the new value but i don't know how to cancat it to the previous value of the column
thank you
 
this line should be

"SET [combination] = '05-Henrichpiramid'" & _

since 05-Henrichpiramid is text

and this line should be

"where [Username]= "' & Text146.value & "' AND actualdate=" & Text148.value & ";")

since I presume that Text146/148 are the names of controls on a form
 
thank you very much for the answer
do you know how i can comine the new value of this column with its prevoius value? ( i mean the column combination)
how i can combine the value of a new textbox with its previous value?
 
for text you use & as in txt1 & txt2
for numbers you use + as in val1+val2
for dates you use the dateadd function
 
thank you for the answer
i have a table and i attached it with its columns
I want that after user update if each of this table's columns (05-henrich piramid,06-matrix,..,,) is equal to yes,for a specific user and date then the the name of the columns will be shown in column cobination. i thought a lot about it. but i don't how to do this?
for example if just 05-henrich piramid is yes then cobination=05-henrich piramid if 05-henrich piramid and 06-matrix are yes then the column combination is 05-henrich piramid,06-matrix
do you have any ideas?
thank you for your help
 

Attachments

  • Unbenannt.jpg
    Unbenannt.jpg
    90.2 KB · Views: 100
Instead of using txt146 it would be better if you used txtMyDate or what ever is applicable.

This may also help us to understand what is what.

Thank You.
 
hello

i have the below code but it has error , do you know where my problem is , the error say " expected function or variable"

Dim str As String
str = DoCmd.RunSQL("select combination from tbl_userinformation where Username= txtuser.value AND actualdate=txtdate.value ; ")

thank you for your help
 
hello
should i open a new post for my other questions?
 
Yes

And it would be a good idea if you closed this one.
 

Users who are viewing this thread

Back
Top Bottom