<p>''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'This if-else checks to see if the end user filled in a product line checkbox.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If j=0 then 'The end user did not fill in a checkbox
Msgbox("You must select a product line")
Else 'The end user filled in a checkbox, proceed to inserting into the C_PROMO_PRODUCTLINES table
txtProductLineString.Text = ""
If j = 1 Then
Set cn = Application.GetNewConnection
For i = 0 to CheckListBox1.Items.Count- 1
If CheckListBox1.Checked(i) = True then
sql_productlines="Insert into C_PROMO_PRODUCTLINES (C_PROMO_PRODUCTLINESID, C_PROMO_HEADER_ACCOUNTID, CREATEUSER,CREATEDATE, PRODUCTLINE) VALUES ('" & Application.BasicFunctions.GetIDFor("C_PROMO_PRODUCTLINES") & "', '" & txtPromoHeaderID.Text & "' ,'" & Application.BasicFunctions.CurrentUserID & "','" & NOW & "' ,'" & CheckListBox1.Items.Item(i) & "')"
cn.Execute sql_productlines
txtProductLineString.Text = CheckListBox1.Items.Item(i)
End If 'Finish inserting into the C_PROMO_PRODUCTLINES table
Next
Else
Set cn = Application.GetNewConnection
For i = 0 to CheckListBox1.Items.Count- 1
If CheckListBox1.Checked(i) = True then
sql_productlines="Insert into C_PROMO_PRODUCTLINES (C_PROMO_PRODUCTLINESID, C_PROMO_HEADER_ACCOUNTID, CREATEUSER,CREATEDATE, PRODUCTLINE) VALUES ('" & Application.BasicFunctions.GetIDFor("C_PROMO_PRODUCTLINES") & "', '" & txtPromoHeaderID.Text & "' ,'" & Application.BasicFunctions.CurrentUserID & "','" & NOW & "' ,'" & CheckListBox1.Items.Item(i) & "')"
cn.Execute sql_productlines
If txtProductLineString.Text = "" Then
txtProductLineString.Text =CheckListBox1.Items.Item(i)
Else
txtProductLineString.Text = txtProductLineString.Text & " AND " & CheckListBox1.Items.Item(i)
End If
End If 'Finish inserting into the C_PROMO_PRODUCTLINES table
Next
end if
End If ' End of the if-else that checks to see if the end user filled in a product line checkbox.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''