Consulting

Results 1 to 2 of 2

Thread: Solved: date error in vb.6 help

  1. #1
    VBAX Contributor
    Joined
    May 2008
    Location
    bangalore
    Posts
    199
    Location

    Solved: date error in vb.6 help

    [vba]
    Dim s5 As String, s6 As String, s7 As String, s8 As String
    s5 = Text1.text

    s6 = Format(s5, "dd/MM/yyyy")
    format(Text1.text,yyyy)
    s8 = Format(Text1.text, "yyyy-mm-dd")
    s7 = Year(s6)
    If (s7 Mod 4) <> 0 Then
    sql = "SELECT DateAdd(d, 365, 'S8') As NewDate"
    Set rs = Con.Execute(sql)
    While Not rs.EOF
    If rs.BOF = False Then
    MsgBox ((NEWDATE))
    End If
    rs.MoveNext
    Wend
    End If
    [/vba]
    I AM GETTING SYNTAX ERROR CONVERTING DATETIME TO CHARACTER TO STRING
    Last edited by shamsam1; 11-22-2008 at 02:31 AM.

  2. #2
    VBAX Contributor
    Joined
    May 2008
    Location
    bangalore
    Posts
    199
    Location
    Quote Originally Posted by shamsam1
    [vba]
    Dim s5 As String, s6 As String, s7 As String, s8 As String
    s5 = Text1.text

    s6 = Format(s5, "dd/MM/yyyy")
    format(Text1.text,yyyy)
    s8 = Format(Text1.text, "yyyy-mm-dd")
    s7 = Year(s6)
    If (s7 Mod 4) <> 0 Then
    sql = "SELECT DateAdd(d, 365, 'S8') As NewDate"
    Set rs = Con.Execute(sql)
    While Not rs.EOF
    If rs.BOF = False Then
    MsgBox ((NEWDATE))
    End If
    rs.MoveNext
    Wend
    End If
    [/vba]
    I AM GETTING SYNTAX ERROR CONVERTING DATETIME TO CHARACTER TO STRING
    sql = "SELECT DateAdd(d, 365, '"& S8 &"') As NewDate"

Posting Permissions

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