Looking up 2 combo boxes and then calculate another field

  • Thread starter Thread starter Alan
  • Start date Start date
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
 
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 <--
 
Back
Top