DTS ActiveX VBScript varchar problem

Posted on 2004-11-03
Last Modified: 2008-02-01
Hi Experts,

I've got an activex script that emails orders out to suppliers.  They need to receive the data in a particular format - and need some field lengths to be a particular size... the problem i'm having is if i use this code....
          elseif = "title" then
          strLine= strLine & chr(34) & left(x.value,4) & chr(34) & chr(44)

and the title field is nchar then i get a field entry of "MR  ",  (which is right) but if the title field is varchar i get "MR",  (which is wrong)

Does anyone know how why this happens or if I can get around it without changing all my database fields?

Many Thanks,
Question by:pjordanna
    LVL 4

    Accepted Solution

    Varchar means the field content is just as long as the data you enter.  In any event you can change your script to fix it:

    strLine= strLine & chr(34) & left(x.value & "    ",4) & chr(34) & chr(44)

    Author Comment

    that's awesome - thanks chanito

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    In today’s complex data management environments, it is not unusual for UNIX servers to be dedicated to a particular department, purpose, or database.  As a result, a SAS® data analyst often works with multiple servers, each with its own data storage…
    SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    745 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

    14 Experts available now in Live!

    Get 1:1 Help Now