Populating list box

  • Thread starter Thread starter Nathan Sanders
  • Start date Start date
N

Nathan Sanders

Hi,

I have a table that contains sales data. I am trying to create a form on
which two dates are entered and the sales figures between those dates is
calculated and shown on the form. Below is the code I have tried
unsuccessfully. if someone can point me in the right direction that would
be great.

Private Sub List6_AfterUpdate()


With Me.List14
.RowSource = _
"SELECT sum(dailysales.fuel) as fuel " & _
"FROM dailysales " & _
"where (dailysale.date) between " & Me.List6 & " and " & Me.List8
.Requery
End With
End Sub


Cheers

Nathan
 
Your approach could work, but the more common solution is to create a query
that uses the unbound date controls of your form as the select criteria.
Make the record source of your form that new query, then when users enter
the date range they want and click a command button to run the underlying
query, the detail section of the form (probably set to continuous form) will
display the filtered sales figures.
-Ed
 
Back
Top