I'm currently working on a script where I import a .json file into a microsoft access database, so far each field enters without issue, except for one field where the characters are more than 255.
To overcome this, i've tried writing in a check on that field to see if the entry is more than 255 characters, and if it is, split it across two other columns.
It all seems to run fine, but when it goes to execute the above, I get an error '3001' invalid argument.
The two additional columns (notessplit1 and notesplit2) are listed in the strsql parameters.
If Len(element("notes")) > 255 Then
Dim notesValue As String
notesValue = element("notes")
' Split the notes value into two parts
Dim maxLength As Integer
maxLength = 255
Dim notessplit As String
Dim notessplit2 As String
If Len(notesValue) > maxLength Then
notessplit1 = Left(notesValue, maxLength)
notessplit2 = Mid(notesValue, maxLength + 1)
Else
notessplit1 = notesValue
notessplit2 = ""
End If
qdef!notes_split1 = notessplit1
qdef!notes_split2 = notessplit2
qdef!notes = ""
Else
qdef!notes = element("notes")
qdef!notes_split1 = ""
qdef!notes_split2 = ""
End If
QDEf.execute
I was expecting that whenever the script comes across an entry greater than 255 characters, the "notes" column would be blank, and the entry would be spread across the two "notessplit" columns.
Instead I just get error 3001: invalid argument.
All other fields up to this point enter fine, including where the notes are less than 255 characters.