Query or VBA code
- From: Monique <Monique@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 2 May 2008 17:53:01 -0700
I have a table of orders called ‘tblDuesod’. I want to calculate the total
cost (EuroSodCost) of the orders which have a delivery date (DelivDate)
between 2 specific dates, then plug plug the result in the control of a
report. I want to do this for each half-month period thru the year.
I made individual queries but cannot figure out how to plug all the results
in a report.
I tried a single query with IIf() and got nowhere.
I turned to code. Here it is but it’s not working. It give me a '€0' in
the report control. I know the connection is working as it finds out that
the field is in euros. Can you help ?
Dim JuneOne As Currency
Dim myConnection As ADODB.Connection
Set myConnection = CurrentProject.Connection
Dim recordset2 As New ADODB.Recordset
recordset2.ActiveConnection = myConnection
recordset2.CursorType = adOpenStatic
recordset2.Open ("SELECT sum(EuroSodCost) AS [JuneOne] FROM tblDuesSod WHERE
(DelivDate) between #6/01/2008# and #6/16/2008#;")
Me![txtJune1] = JuneOne
recordset2.Close
.
- Follow-Ups:
- RE: Query or VBA code
- From: Dale Fye
- Re: Query or VBA code
- From: John Spencer
- Re: Query or VBA code
- From: Evi
- RE: Query or VBA code
- Prev by Date: Re: Union qry- results show #'s not words
- Next by Date: Re: Union qry- results show #'s not words
- Previous by thread: Update query Criteria help needed
- Next by thread: Re: Query or VBA code
- Index(es):
Relevant Pages
|