C
Cynthia
I have a list box that is set for a single selection. I need to change it to
a multiple selection. my problem is I have coding that works with the single
selection and I
do not know how to get it to work with multple selections. I have two
different events running. On the first one below I am taking the item
selected and
and running the code below which changes data in the item, I now need it to
change the data one at a time on all lines selected. How can I get the same
code to work if they selected multiple items?
On the second code below I am setting the rowsource code per the item
selected.
Now I need it to be the first item selected, or the item closest to the top
of the
list selected.
Any help would be greatly appreciated.
-----FIRST EVENT
Private Sub CmdUP_Click()
On Error GoTo Err_CmdUP_Click
Dim route As String
Dim num As Integer
Dim newnum As Integer
Dim Circ As String
Dim id As Integer
DoCmd.SetWarnings False
'If IsNull(listCircList.Value) Then
If IsNull(Me.listCircList.Column(0)) Then
MsgBox "Must Select RaceWay to Move"
Else
id = Me.listCircList.Column(0)
Circ = Me.listCircList.Column(1)
route = Me.listCircList.Column(2)
num = Me.listCircList.Column(3)
newnum = num - 1
If num = 1 Then
MsgBox "Cannot move up already at Top of List"
Else
DoCmd.RunSQL "Update EleCircuitRoute set routenum = " & num & " where
circuit = '" & Circ & "' and routenum = " & newnum & ""
DoCmd.RunSQL "Update EleCircuitRoute set routenum = " & newnum & " where
ID = " & id & ""
Me.Refresh
End If
End If
END SUB
-----SECOND EVENT
Private Sub listCircList_Click()
Dim Circ As String
Dim strSql As String
Dim route As String
If IsNull(listCircList.Value) Then
Circ = ""
route = ""
Else
route = Me.listCircList.Column(3)
End If
strSql = "SELECT qryCircuitRouteID.Circuit, qryCircuitRouteID.CableType FROM
qryCircuitRouteID WHERE (((qryCircuitRouteID.RouteDesc)=""" & route & """))
ORDER BY qryCircuitRouteID.Circuit;"
listCircPerRW.RowSource = strSql
strSql = "Select qryRaceway.RWMat, qryRaceWay.Diameter FROM qryRaceway Where
(((qryRaceway.LineNumber)=""" & route & """)) order by qryRaceway.LineNumber;"
listRWInfo.RowSource = strSql
End Sub
a multiple selection. my problem is I have coding that works with the single
selection and I
do not know how to get it to work with multple selections. I have two
different events running. On the first one below I am taking the item
selected and
and running the code below which changes data in the item, I now need it to
change the data one at a time on all lines selected. How can I get the same
code to work if they selected multiple items?
On the second code below I am setting the rowsource code per the item
selected.
Now I need it to be the first item selected, or the item closest to the top
of the
list selected.
Any help would be greatly appreciated.
-----FIRST EVENT
Private Sub CmdUP_Click()
On Error GoTo Err_CmdUP_Click
Dim route As String
Dim num As Integer
Dim newnum As Integer
Dim Circ As String
Dim id As Integer
DoCmd.SetWarnings False
'If IsNull(listCircList.Value) Then
If IsNull(Me.listCircList.Column(0)) Then
MsgBox "Must Select RaceWay to Move"
Else
id = Me.listCircList.Column(0)
Circ = Me.listCircList.Column(1)
route = Me.listCircList.Column(2)
num = Me.listCircList.Column(3)
newnum = num - 1
If num = 1 Then
MsgBox "Cannot move up already at Top of List"
Else
DoCmd.RunSQL "Update EleCircuitRoute set routenum = " & num & " where
circuit = '" & Circ & "' and routenum = " & newnum & ""
DoCmd.RunSQL "Update EleCircuitRoute set routenum = " & newnum & " where
ID = " & id & ""
Me.Refresh
End If
End If
END SUB
-----SECOND EVENT
Private Sub listCircList_Click()
Dim Circ As String
Dim strSql As String
Dim route As String
If IsNull(listCircList.Value) Then
Circ = ""
route = ""
Else
route = Me.listCircList.Column(3)
End If
strSql = "SELECT qryCircuitRouteID.Circuit, qryCircuitRouteID.CableType FROM
qryCircuitRouteID WHERE (((qryCircuitRouteID.RouteDesc)=""" & route & """))
ORDER BY qryCircuitRouteID.Circuit;"
listCircPerRW.RowSource = strSql
strSql = "Select qryRaceway.RWMat, qryRaceWay.Diameter FROM qryRaceway Where
(((qryRaceway.LineNumber)=""" & route & """)) order by qryRaceway.LineNumber;"
listRWInfo.RowSource = strSql
End Sub