I want a split a result of <= 1000 characters into an array of size 255 and then update a field in the DB with that.
Strings in VBA support a max of 255 characters, so how do I go about doing this?
I am using MS-Access 2007 as my DB, The field type to be updates is Memo, so it can store more than 255 characters, I have checked this.
This is what my query looks like
Coalsce(""SELECT (parentdesc & '/' & keyword) FROM All_Keywords_Mapping where item_id=" & rs1![item_id] & """, ""\;"")
Coalsce is a function that I have written, and it I get a result like:
"abc/123\;Bcd/123\;Bcs/sdasdas\;Casad/sdads\;Fea/dasd adsad\;Fea/Zero\;Lo/somer-tet\;"
now I am updating this result to a field in another table and the field datatype Memo. When the result exceeds 255 chars I get an update query error, so I debugged it and now checking if the length of the result < 255 then only update, it works perfectly fine, but when it exceeds I am unable to do anything.
My coalsce function
Function Coalsce(strSql As String, strDelim As String, ParamArray NameList() As Variant)
Dim db As Database
Dim rs As DAO.Recordset
Dim strList As String
Set db = CurrentDb
If strSql <> "" Then
Set rs = db.OpenRecordset(strSql)
Do While Not rs.EOF
strList = strList & rs.Fields(0) & strDelim
rs.MoveNext
Loop
strList = Mid(strList, Len(strDelim))
Else
strList = Join(NameList, strDelim)
End If
Coalsce = strList
End Function
My query
strSql = Select DISTINCT " & rs1![item_id] & " as item_id, FindReplace(Coalsce(""SELECT (desc & '/' & kw) FROM AKM where item_id=" & rs1![item_id] & """, ""\;""), ""/"", ""\/"") as res
Set rs2 = db.OpenRecordset(strSql, dbOpenDynaset)
DoCmd.RunSQL ("Update data_Query set res=" & rs2.Fields("res").Value)
Dimstatements). As pointed out a few times already,Stringvariables are not limited to 255 chars.Coalsce(?Coalesce?) is. How can we tell what you're doing wrong when you won't show us what you're doing? (You also haven't shown the update statement you're trying to use.)