Results 1 to 4 of 4

remove space in empty variable when using printToFile

Threaded View

  1. #1
    Registered User
    Join Date
    08-12-2011
    Location
    minneapolis
    MS-Off Ver
    Excel 2003
    Posts
    2

    Question remove space in empty variable when using printToFile

    Hi,
    I have data in a worksheet with 3 columns:
    group_name, group_order, and description

    In my macro have the following code:
    With TCode(i)
    printToFile "INSERT INTO t_codes VALUES"
    printToFile " ('" & .group_name & "', " & .group_order & ", '" & .description & "');" End With

    which outputs to a file as:
    INSERT INTO t_codes VALUES
    (1, 0, 'red');

    However, if one of the columns does not have data, e.g. description is blank,
    the output is:
    INSERT INTO t_codes VALUES
    (1, 0, ' ');

    where the description field now has a space as the value. When this file then is run into the database, the end result is incorrect...it *appears* there is data, i.e. a space, rather than a null value (hope that makes sense)

    Is there any way I can remove this space value within in the printToFile?
    Thanks,
    cjg
    Last edited by cjg123; 08-15-2011 at 11:44 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1