Solved

ASP-VBScript problem with Access memo data type

Posted on 1999-01-27
7
366 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

617 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