Looking up 2 combo boxes and then calculate another field

A

Alan

Hi can anyone help

combo box 1 is a customer number 0001 feild(0)
combo box 2 is a posting date 2009/07(1)

Then i have an amount field with all sales that went through

what i need is the textbox to look up on the combo box 1(Customer Number)
which and then look up on combo box 2(Posting Date), then once is lookup on
those variables in the combo boxs, SUM all values for that customer and on
that month and display it

eg

combo box 1 - customer number 0001
Combo Box 2 - Posting period date 2009/07
Text Box - Amount £5000


Thanks , sorry if it seems confusing
 
S

Stefan Hoffmann

hi Alan,

what i need is the textbox to look up on the combo box 1(Customer Number)
which and then look up on combo box 2(Posting Date), then once is lookup on
those variables in the combo boxs, SUM all values for that customer and on
that month and display it
Use DSum() as ControlSource of your TextBox:

=DSum("Amount",
"yourTable",
"CustomerNumber = " & cboCustomer.Value &
" AND Format(dateField, "yyyymm) = '" &
Format(cboDate.Value, "yyyymm") & "'")

This should work, if your customer number is a number and not text and
if your date combo box really selects a date.


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top