Solved

ASP-VBScript problem with Access memo data type

Posted on 1999-01-27
7
361 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
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).

830 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