T
Trepalium
I'm having difficulty with this code... I'm trying to go through and
reference multiple columns for each item that is selected in a list
box. When I run this code it only executes one time and removes one
item when I have two items selected. Code is below. Let me know if
you
have any ideas.. - Thnx
Dim PstClsNme As String, PstClsID As String, PstClsAssignDte As Date,
tpe As String, rw As Variant
Call DBConnect
If List0.ListCount = 0 Then
MsgBox "You must select at least one item to assign!",
vbCritical,
"Error!"
Else
For Each rw In List0.ItemsSelected
tpe = List0.Column(10, rw)
If tpe = "D2RE" Then
D2RE = True
ElseIf tpe = "Partnership" Then
Partner = True
End If
PstClsNme = Combo2.Column(0)
sql = "SELECT USERID, NAME FROM " & tblUserData & " WHERE
NAME = '" & PstClsNme & "'"
rsdata.Open (sql)
If rsdata.EOF Then
MsgBox "Post-Closer could not be located!",
vbCritical, "Post-Closer Not Found!"
rsdata.Close
Else
PstClsNme = rsdata("Name")
PstClsID = rsdata("USERID")
PstClsAssignDte = Format(Date, "mm/dd/yyyy")
rsdata.Close
sql = "INSERT INTO " & tblFileAssign & " VALUES ('" &
PstClsID & "', '" & PstClsNme & "','" & List0.Column(1, rw) & "','" &
PstClsAssignDte & "')"
rsdata.Open (sql)
If D2RE = True Then
sql = "UPDATE " & tblCustInfoD2RE & " SET
ASSIGNED
= 1 WHERE CLAPPLNUMBER = '" & List0.Column(1, rw) & "'"
rsdata.Open (sql)
List0.RemoveItem rw
ElseIf Partner = True Then
End If
End If
Next rw
End If
reference multiple columns for each item that is selected in a list
box. When I run this code it only executes one time and removes one
item when I have two items selected. Code is below. Let me know if
you
have any ideas.. - Thnx
Dim PstClsNme As String, PstClsID As String, PstClsAssignDte As Date,
tpe As String, rw As Variant
Call DBConnect
If List0.ListCount = 0 Then
MsgBox "You must select at least one item to assign!",
vbCritical,
"Error!"
Else
For Each rw In List0.ItemsSelected
tpe = List0.Column(10, rw)
If tpe = "D2RE" Then
D2RE = True
ElseIf tpe = "Partnership" Then
Partner = True
End If
PstClsNme = Combo2.Column(0)
sql = "SELECT USERID, NAME FROM " & tblUserData & " WHERE
NAME = '" & PstClsNme & "'"
rsdata.Open (sql)
If rsdata.EOF Then
MsgBox "Post-Closer could not be located!",
vbCritical, "Post-Closer Not Found!"
rsdata.Close
Else
PstClsNme = rsdata("Name")
PstClsID = rsdata("USERID")
PstClsAssignDte = Format(Date, "mm/dd/yyyy")
rsdata.Close
sql = "INSERT INTO " & tblFileAssign & " VALUES ('" &
PstClsID & "', '" & PstClsNme & "','" & List0.Column(1, rw) & "','" &
PstClsAssignDte & "')"
rsdata.Open (sql)
If D2RE = True Then
sql = "UPDATE " & tblCustInfoD2RE & " SET
ASSIGNED
= 1 WHERE CLAPPLNUMBER = '" & List0.Column(1, rw) & "'"
rsdata.Open (sql)
List0.RemoveItem rw
ElseIf Partner = True Then
End If
End If
Next rw
End If