Originally posted by Dubya007
....what i am trying to get VB to do is to read in all the values for the machiines and then in a combo box put the date(s) that corrospond to that machine.
what values should VB read ? the entry date ?

from szlamany's t-sql :

SELECT THECOLUMN,SUM(1) FROM THETABLE GROUP BY THECOLUMN HAVING SUM(1)>1

change to :

SELECT machine_id,SUM(1) FROM machineTABLE GROUP BY machine_id HAVING SUM(1)>1

the query will list machine with more than one entry date. then you can use the ID to get the entry date and put in combo box.

VB Code:
  1. private sub module_one()
  2.    dim rs as new adodb.recordset
  3.    'assume that myconn is your connection var
  4.  
  5.    rs.open "SELECT machine_id,SUM(1) FROM machineTABLE GROUP BY machine_id HAVING SUM(1)>1",myconn,adopenkeyset,adlockoptimistic,adcmdtext
  6.  
  7.    if rs.recordcount>0 then
  8.       rs.movefirst
  9.  
  10.       do while not rs.eof
  11.            call fill_combo(trim(rs!machine_id))
  12.  
  13.            rs.movenext
  14.       loop
  15.    end if
  16.  
  17.    rs.close
  18.    set rs=nothing
  19. end sub
  20.  
  21. private sub fill_combo(byval machine_id as string)
  22.      dim rs2 as new adodb.recordset
  23.  
  24.       rs2.open "select entry_date from machineTABLE where machine_id = '" & trim(machine_id) & "' order by entry_date asc", myconn,adopenkeyset, adlockoptimistic, adcmdtext
  25.  
  26.       if rs2.recordcount > 0 then
  27.            rs2.movefirst
  28.            
  29.            do while not rs2.eof
  30.                 'assume combobox name = Combo1
  31.                 combo1.additem format(rs2!entry_date, "mm/dd/yyyy")
  32.  
  33.                 rs2.movenext
  34.            loop
  35.       end if
  36.  
  37.       rs2.close
  38.       set rs2=nothing
  39. end sub

do i make mistake here with the help ? i hope that's your point....
if not, pls clarify me / us here.