![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi folks, I'm using Access 2007 as the front end and SQL server as the backend of an application I have written. I am also using Windows XP. I have a subform which holds employee time bookings for the day, held as minutes. The idea is, when an employee is selected from the main form, all of his / her bookings display in the subform. However, I need to total these minutes to display in the subform footer. I want the total minutes to display as hours and minutes, not just a sum of minutes. My basic problem is, I can't find an event on the subform which fires when the sub form has been completely populated. On Open, On Activate, non of them fire. Is there a way of making an event fire when the sub form is populated with new data? I have attempted two ways of getting round this. Firstly I have used the sum function in a control source in the sub form footer as follows =sum([mins]/60). As you might expect, this gives slightly odd results. For example 2 hours 25 minutes is displayed as 2.42 hours. My second method is to write a function which I also call from a control source, i.e. =TSHoursAndMinutes(). I know that this works ok, because if I put it on a button it gives exactly the right result, i.e. 2 hours 25 minutes. However on the control source it always returns 0 hours 0 minutes. It's almost as if, unlike the sum function, my function runs before the detail section gets populated. Any ideas how I can get round this. It seems like it should be so simple to me, yet it's causing me real problems. Thanks for any help, Colin in the footer, create a text box (invisible) called minutes, =sum(..) |
#3
| |||
| |||
|
|
On Mar 26, 2:19�am, Bobby <bob... (AT) blueyonder (DOT) co.uk> wrote: Hi folks, I'm using Access 2007 as the front end and SQL server as the backend of an application I have written. I am also using Windows XP. I have a subform which holds employee time bookings for the day, held as minutes. The idea is, when an employee is selected from the main form, all of his / her bookings display in the subform. However, I need to total these minutes to display in the subform footer. I want the total minutes to display as hours and minutes, not just a sum of minutes. My basic problem is, I can't find an event on the subform which fires when the sub form has been completely populated. On Open, On Activate, non of them fire. Is there a way of making an event fire when the sub form is populated with new data? I have attempted two ways of getting round this. Firstly I have used the sum function in a control source in the sub form footer as follows =sum([mins]/60). As you might expect, this gives slightly odd results.. For example 2 hours 25 minutes is displayed as 2.42 hours. My second method is to write a function which I also call from a control source, i.e. =TSHoursAndMinutes(). I know that this works ok, because if I put it on a button it gives exactly the right result, i.e. 2 hours 25 minutes. However on the control source it always returns 0 hours 0 minutes. It's almost as if, unlike the sum function, my function runs before the detail section gets populated. Any ideas how I can get round this. It seems like it should be so simple to me, yet it's causing me real problems. Thanks for any help, Colin in the footer, create a text box (invisible) called minutes, =sum(..) create as 2nd visible text box, =cint(minutes / 60) & ":" & (minutes mod 60)- Hide quoted text - - Show quoted text - |
#4
| |||
| |||
|
|
On 26 Mar, 09:43, Roger <lesperan... (AT) natpro (DOT) com> wrote: in the footer, create a text box (invisible) called minutes, =sum(..) create as 2nd visible text box, =cint(minutes / 60) & ":" & (minutes mod 60) Thanks. I found it worked better with Fix rather than CInt, but thats great, |
![]() |
| Thread Tools | |
| Display Modes | |
| |