A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Looking up 2 combo boxes and then calculate another field



 
 
Thread Tools Display Modes
  #1  
Old March 23rd, 2010, 11:45 AM posted to microsoft.public.access.forms
Alan
external usenet poster
 
Posts: 459
Default Looking up 2 combo boxes and then calculate another field

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

  #2  
Old March 23rd, 2010, 12:09 PM posted to microsoft.public.access.forms
Stefan Hoffmann
external usenet poster
 
Posts: 991
Default Looking up 2 combo boxes and then calculate another field

hi Alan,

On 23.03.2010 12:45, Alan wrote:
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 --
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:52 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.