Solved

ASP-VBScript problem with Access memo data type

Posted on 1999-01-27
7
357 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Uploading files to the web server has become common part of almost any kind of web application. People use different technologies to solve this, but regardless of the technology used, it is always useful to have some kind of progress indicator shown…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to count occurrences of each item in an array.

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now