Solved

ASP-VBScript problem with Access memo data type

Posted on 1999-01-27
7
359 Views
Last Modified: 2013-12-25
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
    Dim strArray

    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
      Response.Write "<UL>"
      strArray = Split(strData, "\", -1, 1)
      For Each str in strArray
        Response.Write "<LI>" & str
      Next

      'Cleanup the table row
      Response.Write "</UL></TD></TR>"
    End If
  End Sub  
%>

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?
0
Comment
Question by:derekl
  • 3
  • 3
7 Comments
 

Author Comment

by:derekl
ID: 1859257
Edited text of question
0
 

Author Comment

by:derekl
ID: 1859258
Edited text of question
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 1859259
I think it has to do with your strComp command there... Should it be something more like


If StrComp(strData, " ") <> NULL Then  ' if either string is NULL, then the value returned is NULL.

This way, if strData is null, it will skip the field...

- OR -

Is the string that is being passed to the split function a valid string.  Maybe wrap it in the CStr() function to convert it to a string.

Just some ideas.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:derekl
ID: 1859260
I guess I should add that if I remove the strComp() function altogether, the split() function works fine.
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 1859261
Can you email me the database and script?  Is it too large?  I would like to see if I can get it to work.

masseym@mrqcorp.com
0
 
LVL 6

Expert Comment

by:PBall
ID: 1859262
Perhaps it's a good idea to add a check at the beginning of Split function...

function Split(src,.......)
  if len(src) = 0 or isNull(src) then
    Split = ""
    exit function
   end if
 :
 :
end function
0
 
LVL 10

Accepted Solution

by:
MasseyM earned 200 total points
ID: 1859263
You need to open with the correct CursorSet...

use
rs.open sql, connection, 3, 3
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question