RE: Inserting calculation field on form



"Ammo" wrote:

> Hi Steve,
>
> I have emailed you the db as requested.
>
> Kind Regards
>
> Ammo
>

I received your database. After looking at it, I was still puzzled as to why
DSUM() wasn't working. So before I created the new queries, I took another
look at your formula for "TotalGrantRemaining".

There I was, looking at the form, thinking about creating the queries when
it happened!! Kind of like the guy that stayed up all night wondering where
the sun went when it went down, when it finally dawned on him! <g>

The DSUM() function is nothing more than a really, really limited query. You
have a source (the table), a field to search and a where clause (without the
where). And in a query, you *can't* use "Me.ControlName". You *have* to use
"Forms!FormName.ControlName".

Here is the new control source for "TotalGrantRemaining". (I rearranged the
terms)

=[AvailableGrant]-DSum("[AmountGrantAllocated]","tbl_GrantApplicant","[GrantStatus] = True and [GrantPotNumber] = " & Forms!frm_GrantPot.GrantPotNumber)


Then, to get the "TotalGrantRemaining" to update when you change the
subform, from the databasewindow, open "frm_GrantApplicant subform" in design
view. In the FORM AfterUpdate event, enter: Me.Parent.Refresh

It should look like this:

Private Sub Form_AfterUpdate()
Me.Parent.Refresh
' you might be able to to use instead
' Me.TotalGrantRemaining.Requery
End Sub

Two simple changes.... :-D It should work now......
---
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)
.



Relevant Pages

  • RE: Inserting calculation field on form
    ... Kind Regards ... Ammo ... >> Hi Steve, ... >> new records into the sub form (grant applicant details) ...
    (microsoft.public.access.formscoding)
  • Re: User Rights Assignment - not available - Resolved
    ... Thanks Steve for your effort to help me here. ... If none of that works I would try an upgrade/repair install ... it shows user rights and use the Resource Kit command line tool ... This operation may find that this database is corrupt ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Auto enter date or time on double click
    ... G'day Steve - I am doing the exact same thing - trying to set up a ... And I looking for the exact same solution to the autodate/time and then ... I would like to see your database to see what you've done if thats OK ... > I would like to lock the time/date field once the record has been ...
    (microsoft.public.access.setupconfig)
  • Re: Is access the right programe to use?
    ... "Steve demonstrated creativity, ... programming expertise was invaluable to us. ... wants me to write additional database systems for them, ... Your very helpful email speaks volumes about your level of professionalism. ...
    (microsoft.public.access.gettingstarted)
  • RE: Inserting calculation field on form
    ... "Ammo" wrote: ... > Hi Steve, ... > new records into the sub form (grant applicant details) ... If you want, delete most of your data (and ALL of the sensitive data), ...
    (microsoft.public.access.formscoding)