Results 1 to 3 of 3

Thread: resolved convert error

  1. #1

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    resolved convert error

    Hi,

    I need help on the below code

    Code:
                If RSQAB1!Status_Varchar = "Live" Then
                    SQL_str = SQL_str & ", CONVERT(datetime,'" & Format(RSQAB1!PolicyStartDate_DateTime, "dd/mm/yyyy hh:mm:ss") & "',103)"
                    SQL_str = SQL_str & ", CONVERT(datetime,'" & Format(RSQAB1!PolicyEndDate_DateTime, "dd/mm/yyyy hh:mm:ss") & "', 103)"
                 Else
                   ' SQL_str = SQL_str & ", '" & "" & "'"
                   ' SQL_str = SQL_str & ", '" & "" & "'"
                    
                  SQL_str = SQL_str & ",'',''"
                    'SQL_str = SQL_str & "''"
                End If

    I keep getting a convert error on the below code
    Code:
     SQL_str = SQL_str & ",'',''"
    Thanks
    Last edited by holly; Mar 3rd, 2008 at 08:54 AM.
    ** HOLLY **

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: convert error

    It would be useful to know what the error message is, and what you are trying to achieve with that code.

    In this case I suspect what you are trying to do is leave that column blank, is that correct?

    If so, and assuming that the lines with Convert in them work, you should be able to use this:
    Code:
     SQL_str = SQL_str & ", Null, Null"

  3. #3

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Re: Resolved convert error

    Quote Originally Posted by si_the_geek
    It would be useful to know what the error message is, and what you are trying to achieve with that code.

    In this case I suspect what you are trying to do is leave that column blank, is that correct?

    If so, and assuming that the lines with Convert in them work, you should be able to use this:
    Code:
     SQL_str = SQL_str & ", Null, Null"

    Thanks Si for all you help!!!

    ** HOLLY **

Posting Permissions

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



Click Here to Expand Forum to Full Width