Really I don't how to use SQL and VB, I was just using the
Dsum("[Market Value]", "[table name]") in the expression builder box.
this did do what i wanted it to do. But the problem is that when i
imported this to excel, all other fields imported except the Total
Market Value (the dsum function). Please help if you can ?
I believe i have to use
SELECT [Value Date]. [Assed Class], [Yield], [Market Value], (SELECT
> Sum([Market Value] FROM yourtable) AS TotalMarketValue;
in the vb editor page, as new module ? is that ryte ?
also when you say yourtable ? my table name is "home data range"
should that be in parenthesis or bracket or "" ?
Thanks, really appreciate your help
On Jun 9, 2:34*pm, John W. Vinson <jvinson@STOP_SPAM.WysardOfInfo.com>
wrote:
> On Thu, 9 Jun 2011 09:43:05 -0700 (PDT), Taha Ahmed
>
>
>
>
>
> <tahaahme...@googlemail.com> wrote:
> >Hi i am new to access, not using code just the basics..
>
> >the problem is i have 4 columns and need another one... called total
> >market value..
>
> >value date / asset class / yield / market value
>
> >so i need a 5th one .. *I want it to display the total of the market
> >value at each record...
>
> >for example..
>
> >5/1/2010 / muni / 5%/ 50000/160000
>
> >5/2/2010/ corp/ 6%/ 60000/160000
>
> >5/3/2010/ corp/ 7%/ 50000/160000
>
> >i tried using the sum .. i enter in the build sum("[market value]") it
> >doesn't work.. it says" you tried to execute the query that does not
> >include the specified expression "value date" as a part of the
> >aggregate function",
>
> >i have even tried to use dsum, that apparentlyw orks but that does not
> >allow me to import the total field in excel.
>
> >btw i am using access 2003..
>
> >please help
>
> I'm not sure I follow. What was the SQL view of the query using DSum()? And
> what exactly are you summing? What happened when you tried to export?
>
> A pure SQL solution would use a Subquery:
>
> SELECT [Value Date]. [Assed Class], [Yield], [Market Value], (SELECT
> Sum([Market Value] FROM yourtable) AS TotalMarketValue;
>
> The subquery could have criteria if "at each record" refers to some subset of
> the data in the table.
> --
>
> * * * * * * *John W. Vinson [MVP]
> *Microsoft's replacements for these newsgroups:
> *http://social.msdn.microsoft.com/For...-US/accessdev/
> *http://social.answers.microsoft.com/.../en-US/addbuz/
> *and see alsohttp://www.utteraccess.com- Hide quoted text -
>
> - Show quoted text -