I have a large database in access with one field having repeated values. I used a Select Distinct statement to fill a listbox with one of each value in that field. Now I want to select one of these values and get the average of the data from another field for all of the records with this value and put it into a textbox. It seems to get the data and take the average, but I don't know how t get the final number into a textbox. The code below is what I have been using.
Private Sub Form_Load()
Set ashcmd = New ADODB.Command
ashcmd.ActiveConnection = ashconn
Set ashrs = New ADODB.Recordset
ashsources = "select distinct Source from Flyash"
ashcmd.CommandText = ashsources
'Filling source listboxes with Ash sources in database.
While (Not ashrs.EOF)
Private Sub lstash_Click()
Set ashsbcmd = New ADODB.Command
ashsbcmd.ActiveConnection = ashconn
Set ashsbrs = New ADODB.Recordset
ashsbrs.ActiveConnection = ashconn