Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dsum - Dsum Syntax &?@%*$

Status
Not open for further replies.

andrep

Technical User
Feb 27, 2002
40
0
0
CA
DSum("[Quantity]","Order details","[ProdID] = " & Me![ProdId])
minus the below
DSum("[Quantity]","Stock ordered","[ProdID] = " & Me![ProdId])

Using an update query to return the differencial values!

In other words what I have bought minus what I have sold!
The Id key is giving a handfull or problems (ie key violations!

Thanks in advance !


 
Andrep. Seems if you just broke it down it'd work.

Dim A, B, C As Intergers

A = DSum("[Quantity]","Order details","[ProdID] = " & Me![ProdId])

B = DSum("[Quantity]","Stock ordered","[ProdID] = " & Me![ProdId])

C = A - B

MyTextbox = C
 
Thanks Isadore,

I see this is not going to work !

I did say update query ! So how does the query obtain the a b c as you stated ?

better yet i could always loop through the form when it is open to trigger the calculation if i knew how to do it ?

So let's try the later !

a = me!bought
b= me!sold
c= a-b
me!instock = c

Which gives me the differencial for one control on the form!
Form is called inventory !

so if i have 380 different a, b, and c's to calculate how do i go through each in one single step !

Thanks again!
 
andrep,
Try this:
Select a new field in your query and populate it as:
AA: dsum(etc....

Next another new field:
BB: dsum(etc... {number two dsum equation}

Next new field:
CC: AA - BB

Some brackets go their someplace...

This should work. I usually do this via code so....

Later!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top