I'm trying the return the value of a row in a listbox when clicked.
This code looks like it should work to return the value at the
selected row, but it doesn't:
Private Sub ListCollections_AfterUpdate()
Dim ctr As Integer
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
Dim rs As ADODB.Recordset
Dim sql As String
Set rs = New ADODB.Recordset
MsgBox ListCollections.Selected(0)
For ctr = 0 To ListCollections.ListCount - 1
If ListCollections.Selected(ctr) = True Then
sql = "select startdate,enddate from collections where
collectionid = " & CStr(ListCollections.Value)
rs.Open sql, cnn
CalAltCollec1.Value = rs(0)
CalAltCollec2.Value = rs(1)
End If
Next
End Sub
It never enters the IF statement.
How do I do this?
Thanks
JOS
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/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/