I am writing an ASP based web page which uses information from an Access database to generate a custom resume for employees based on field data. Because not all of the fields in the database are required, I would like to be able to test for this condition and avoid outputting the table row corresponding to that particular field. I wrote the function below to accomplish this:
'Functions used on this page
Sub OutputResumeRow(strTitle, strData, nWidth)
'Variables used internally
If StrComp(strData, "") Then
'Ouput first column with title and setup for second
Response.Write "<TR><TD ALIGN=RIGHT VALIGN=TOP><B>" & strTitle & "</B></TD><TD WIDTH=" & nWidth & "ALIGN=LEFT VALIGN=TOP>"
'Parse string and output as an unordered list
strArray = Split(strData, "\", -1, 1)
For Each str in strArray
Response.Write "<LI>" & str
'Cleanup the table row
I use strComp to check for a null string, which is the default value in Access, if the string is null, then the table row output is skipped. The split function is used to seperate items in the string delimited by '\' in order to generate an unordered list <UL>. This works fine when the Access data type is 'text' however, when the data type is 'memo' I get the following error when attempting to execute the split function:
Microsoft VBScript runtime error '800a005e'
Invalid use of Null: 'Split'
/Personnel.asp, line 26
What's the deal here?