Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE DB error

Status
Not open for further replies.

lexis7

Programmer
Sep 23, 2002
26
US
hi,
I have a list box on a form that is multi-select and the items selected are saved back into one field in a table. This works great when an item in the list is selected, however when nothing is selected from this list box i get an error message of:

"multiple-step OLE DB operation generated errors. check each OLE DB status value, if available. No work was done"

Im using the code:
Dim varRow As Variant
Dim strSQL As String
strSQL = vbNullString
For Each varRow In lstRetailPartnerSite.ItemsSelected
strSQL = strSQL & lstRetailPartnerSite.Column(0, varRow) & ", "
Next varRow
rs![Retail Partner Sites] = strSQL


Can anyone help me with this problem?
Thanks so much for any help.
 
You could try initializing with a space or empty value.
strSQL = " "
Are you just leaving the comma on the end of the string?
 
Check your string before updating the field:

If Len(strSQL) > 0 Then
rs![Retail Partner Sites] = strSQL
Else
MsgBox "Please select an item."
End If

VBSlammer
redinvader3walking.gif
 
Thanks everyone!

I just replaced my string value with strSQL= ""
and it worked great!

I appreciate all your help.

alexis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top