Re: Sub form events not firing



On 26 Mar, 09:43, Roger <lesperan...@xxxxxxxxxx> wrote:
On Mar 26, 2:19�am, Bobby <bob...@xxxxxxxxxxxxxxxx> 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 -

Thanks. I found it worked better with Fix rather than CInt, but thats
great,

Colin
.



Relevant Pages

  • Re: Still I need to know how
    ... invoices this is usually the invoice number. ... Inv_No Footer if your field is called Inv_No ... One of the lines there will be labelled Control Source. ... If it is not main form and sub form how ...
    (microsoft.public.access.reports)
  • RE: Display Count
    ... Name: txtCountGroup ... Then add a text box to your report footer: ... Control Source: =txtCountGroup ... There are 182 Clients that display in the footer. ...
    (microsoft.public.access.reports)
  • Re: Still I need to know how
    ... I need invoice number in 2nd page ... My report has page numbers in footer. ... One of the lines there will be labelled Control Source. ... If it is not main form and sub form how ...
    (microsoft.public.access.reports)
  • Re: Project...
    ... Please never talk about an error without telling the exact error message you get as this is your first diagnosis tool. ... users will only see something to warn them when someone else ordered the same product between the display of the product form and the actual ordering... ... from the main form to the sub form, but then when I go back the the main form ... to update info, it crashes. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How do I get the sub form to display a blank record?
    ... lookup display a value of blank. ... my sub form still displays ... Edits & Additions in a graceful manner. ... "project code" and many sub form records that reference that project ...
    (microsoft.public.access.forms)