Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP-VBScript problem with Access memo data type

Posted on 1999-01-27
7
Medium Priority
?
375 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 600 total points
ID: 1859263
You need to open with the correct CursorSet...

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

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

885 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