Calculation Issues in VBA

hhzyousafi

Registered User.
Local time
Tomorrow, 03:38
Joined
Nov 18, 2013
Messages
74
I have been stuck on this for the past couple of days and it seems I am getting absolutely nowhere. I am having an extremely difficult time calculating values which seem, for the most part, very straight forward. I have done quite a bit of debugging and I have been able to isolate the issue to the following code:

'If txtActualManHours.Visible = True Then
'ActualManHourstblTaskHistory = txtActualManHours.Value
'ActualManHourstblTasks = txtActualManHourstblTasks.Value
'txtActualManHourstblTasks.Value = ActualManHourstblTasks + ActualManHourstblTaskHistory
'Else
'End If​

A little background behind this code is I have a table called "tblTasks" and another table called "tblTaskHistory". "tblTasks" and "tblTaskHistory" have a one to many relationship. There is a field in "tblTasks" called "txtActualManHours" and that field shows on the current form - a form that is bound to the table "tblTaskHistory". All I am trying to do is increment the parent table field "txtActualManHours" with the value in the field with the same name in the table "tblTaskHistory". I have been able to pass values for strings without any issues using VBA; however these values are currently stored as "Double" and Access keeps giving me an error.
 
Hi Paul,

I want to be able to determine the total amount of time a resource has spent on a task. Basically this field exists in the table and I would like to populate the table with the correct value. I completely understand what Bob is referring to in his article; however the user cannot manipulate the values so I feel I am protected from any potential issues. I am sure that's how everyone feels when they are trying to justify poor coding logic? :)

Regards,

Zohair Yousafi
 
I completely understand what Bob is referring to in his article;
Who's Bob?
I want to be able to determine the total amount of time a resource has spent on a task. Basically this field exists in the table and I would like to populate the table with the correct value.....however the user cannot manipulate the values so I feel I am protected from any potential issues.
Still, I fail to see a reason to store this value. More the reason for you to display the value in an unbound Text box to get you going with this.
 
Allen Browne* instead of Bob. Bob as in Bob Larson - he has been extremely helpful as well so I just had his name "on tap". I know the logic seems a little awry; however it makes sense, at least in my mind, when a user is entering his/her basic data. It gives me more options to be able to use that data. At least a simpler way to use that data.
 
I will wait for a while, before posting a solution.
 

Users who are viewing this thread

Back
Top Bottom