Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jewel
Starting Member
18 Posts |
Posted - 2004-11-03 : 21:42:26
|
| hi allIf I have an hours field and a mins fieldhow do I merge the two fields to add together in a report, as I need to add both together for grouping of project hours.eg Fields!WorkHours.Value and Fields!WorkMins.ValuethanksDianne |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-11-03 : 22:36:27
|
| format this in your presentation layer. i'm assuming your using vb based on your last post.total=rs.fields!workhours.value + cdbl(rs.fields!workmins.value/60)--------------------keeping it simple... |
 |
|
|
jewel
Starting Member
18 Posts |
Posted - 2004-11-04 : 18:17:34
|
| thanks JenI come from an access background - and am now using MS Visual Studio.net 2003 so am a total newbie or it seems like it now! am still trying to get my head around the differencesok I added what you said into my layout =total=rsFields!WorkHours.Value & " " & cdbl(rs.Fields!WorkMins.Value/60)but then get the errorThe value expression for the textbox 'WorkHours' contains an error. BC30451 Name 'total' is not declared.ok so I am presuming in my data tab I need to add the field again with total? my code is as follows:SELECT dbo.Call.CallNumber, dbo.Call.CallSubject1, dbo.Call.LastName, dbo.Call.FirstName, dbo.Worktime.WorkDateTime, dbo.Call.OrgLvlCode AS Dept, dbo.Call.CallStatus AS Status, dbo.Worktime.WorkHours, dbo.Worktime.WorkMins, dbo.Call.Ref3 AS Project, dbo.Worktime.Ref1, dbo.Call.Ref2FROM dbo.Call INNER JOIN dbo.Worktime ON dbo.Call.CallNumber = dbo.Worktime.CallNumberWHERE (dbo.Worktime.WorkDateTime > @myDate) AND (dbo.Call.CallSubject1 LIKE 'Project%') AND (dbo.Worktime.WorkDateTime <= @enddate) AND (dbo.Call.Ref2 LIKE 'JS%')ORDER BY dbo.Call.CallSubject1 DESC, dbo.Call.Ref2I am hoping to do a course over the next couple of months to try and understand but appreciate your help in between |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-11-04 : 22:08:12
|
| the total is an object where you wish to show your computed value.and you forgot the "+" sign.so if you have a textbox and the recordset is pointed in the right record, then:textbox1.text=rs.fields("workhours") + cdbl(rs.fields("workmins")/60)i am assuming that workhours and workmins are integer type? if yes, then you need to convert them to double to have the division working for you.--------------------keeping it simple... |
 |
|
|
|
|
|
|
|