Problem in DTPicker

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sreegans
    New Member
    • Apr 2008
    • 9

    Problem in DTPicker

    Hi..

    I'd a problem while using the DTPicker in VB form.

    While executing the sql statement,

    cn.execute "insert into empdetails values(' " & DTPicker1.value & " ')"

    Got the error as overflow.... pl help me..how to avoid this...?

    Sree
  • CyberSoftHari
    Recognized Expert Contributor
    • Sep 2007
    • 488

    #2
    You must explain your problem in detail.

    [CODE=vb]"insert into empdetails values(#" & DTPicker1.value & "#)"[/CODE]
    the date time is not a string (in MS Access)

    Comment

    • sreegans
      New Member
      • Apr 2008
      • 9

      #3
      Originally posted by CyberSoftHari
      You must explain your problem in detail.

      [CODE=vb]"insert into empdetails values(#" & DTPicker1.value & "#)"[/CODE]
      the date time is not a string (in MS Access)

      Hi..

      Thks a lot for ur quick reply..
      I'm using sql and not ms access..
      I'm getting error as overflow while running this form...
      How to insert this date into the database using sql query?

      Sree....

      Comment

      • CyberSoftHari
        Recognized Expert Contributor
        • Sep 2007
        • 488

        #4
        [CODE=vb]"insert into empdetails values(#" & Format(DTPicker 1.value,"yyyy/MM/dd") & "#)"[/CODE]

        You have to pass the date fomat like "MM/dd/yyyy" or "yyyy/MM/dd". (Asum that will be date month overflow).

        Comment

        • sreegans
          New Member
          • Apr 2008
          • 9

          #5
          hi..

          thks alot..

          Sree.

          Comment

          Working...