I am updating the contents of one list box based on the selection in 
another.

It works fine when they click at item (or several) in the controlling 
list box, but if they scroll in the controlling list box, the values 
in the second box are what the previous value in the controlling box 
were.

How can I make this work?

Here is the code.  I have put it in click, before update and after 
update with the same results

On Error GoTo erh
DoCmd.SetWarnings False
Dim ctr As Integer
Dim sql As String
Dim theList As String

For ctr = 0 To List51.ListCount - 1
  If List51.Selected(ctr) <> 0 Then
   theList = theList & "'" & Trim(List51.ItemData(ctr)) & "',"
  End If
Next

theClasses = ""

sql = "SELECT distinct local_class.class, local_class.class_desc, 
local_class.ca_otb FROM local_class,pd_classes pd " & _
      "where pd.pdid2 = local_class.class "
If Trim(theList) <> "" Then
        theList = Mid(theList, 1, Len(theList) - 1) & ",'-1'"
        sql = sql & " and  local_class.ca_otb in (" & theList & ") "
                
        theClasses = theList
Else
sql = sql & " order by local_class.class_desc"
End If

List44.RowSource = sql
'if I put requery here it gives an error
Me.Repaint
isClicked = True
Exit Sub

erh:
Close
Open "\\Datastore-sf\Data\Planning\AccessLogs\pos.log" For Append As 
#99
Print #99, CStr(Now) & " " & CStr(Err.Number) & " " & CStr
(Err.Description)
Close





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/q7folB/TM
--------------------------------------------------------------------~-> 


Please zip all files prior to uploading to Files section. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AccessDevelopers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to