I don't do a lot of with the "Code" part of SSRS so this is just a guess.
your line totaltextbox40 = totaltextbox40 + textbox40 references report objects. you might have to reference using the ReportItems Collection.
reportitems!totaltextbox40.value = reportitems!totaltextbox40.Value + reportitems!textbox40.Value