Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. update DATE error....?

update DATE error....?

Scheduled Pinned Locked Moved Visual Basic
helpdatabasesalesquestionannouncement
13 Posts 5 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    campbells
    wrote on last edited by
    #1

    i had found my error which is the DATE cause the problem... anyway to update my DATE field?? will it becasue of the format? because i found out that my vb when i put"NOW" it will include the time with it. But with my access i had set it as DATE only. Date= " & "'" & ddate.Text & "'" & _ Here my full coding: DB.Execute "update DONO set NO=" & "'" & dono.Text & "'" & _ ",Date= " & "'" & ddate.Text & "'" & _ ",Customer=" & "'" & Combo1.Text & "'" & _ ",Description =" & "'" & ddes.Text & "'" & _ ",Total =" & "'" & temptotal.Caption & "'" & _ ",BillTerm=" & "'" & dterm.Text & "'" & _ " where [dono] = " & "'" & userin & "'"

    M R 2 Replies Last reply
    0
    • C campbells

      i had found my error which is the DATE cause the problem... anyway to update my DATE field?? will it becasue of the format? because i found out that my vb when i put"NOW" it will include the time with it. But with my access i had set it as DATE only. Date= " & "'" & ddate.Text & "'" & _ Here my full coding: DB.Execute "update DONO set NO=" & "'" & dono.Text & "'" & _ ",Date= " & "'" & ddate.Text & "'" & _ ",Customer=" & "'" & Combo1.Text & "'" & _ ",Description =" & "'" & ddes.Text & "'" & _ ",Total =" & "'" & temptotal.Caption & "'" & _ ",BillTerm=" & "'" & dterm.Text & "'" & _ " where [dono] = " & "'" & userin & "'"

      M Offline
      M Offline
      mr_lasseter
      wrote on last edited by
      #2

      It depends on what database you are using.

      Mike Lasseter

      C 1 Reply Last reply
      0
      • M mr_lasseter

        It depends on what database you are using.

        Mike Lasseter

        C Offline
        C Offline
        campbells
        wrote on last edited by
        #3

        i'm using microsoft access

        M 1 Reply Last reply
        0
        • C campbells

          i'm using microsoft access

          M Offline
          M Offline
          mr_lasseter
          wrote on last edited by
          #4

          For using dates in access you will need to use # around the date instead of '. Example: #8/23/06#

          Mike Lasseter

          C 1 Reply Last reply
          0
          • M mr_lasseter

            For using dates in access you will need to use # around the date instead of '. Example: #8/23/06#

            Mike Lasseter

            C Offline
            C Offline
            campbells
            wrote on last edited by
            #5

            not working here coding: ",Date= " & "'" & "#" & ddate.Text & "#" & "'" & _ even i put it as ",Date= " & "'#" & ddate.Text & "#'" & _ not working too

            M 1 Reply Last reply
            0
            • C campbells

              not working here coding: ",Date= " & "'" & "#" & ddate.Text & "#" & "'" & _ even i put it as ",Date= " & "'#" & ddate.Text & "#'" & _ not working too

              M Offline
              M Offline
              mr_lasseter
              wrote on last edited by
              #6

              ",Date= " & "'" & "#" & ddate.Text & "#" & "'" & _ even i put it as ",Date= " & "'#" & ddate.Text & "#'" & _ The above lines equate to the same sting to send to the database. Both of which have ' around the date still. You don't need the single quotes for dates in access. Use the following: ",Date= " & "#" & ddate.Text & "#" & _

              Mike Lasseter

              C 1 Reply Last reply
              0
              • M mr_lasseter

                ",Date= " & "'" & "#" & ddate.Text & "#" & "'" & _ even i put it as ",Date= " & "'#" & ddate.Text & "#'" & _ The above lines equate to the same sting to send to the database. Both of which have ' around the date still. You don't need the single quotes for dates in access. Use the following: ",Date= " & "#" & ddate.Text & "#" & _

                Mike Lasseter

                C Offline
                C Offline
                campbells
                wrote on last edited by
                #7

                ...is not working too..

                G 1 Reply Last reply
                0
                • C campbells

                  ...is not working too..

                  G Offline
                  G Offline
                  Guffa
                  wrote on last edited by
                  #8

                  Standard question #1: What do you mean by "not working"? Standard question #2: What error message do you get? You are probably using a date format that the database doesn't recognise.

                  --- b { font-weight: normal; }

                  C 1 Reply Last reply
                  0
                  • G Guffa

                    Standard question #1: What do you mean by "not working"? Standard question #2: What error message do you get? You are probably using a date format that the database doesn't recognise.

                    --- b { font-weight: normal; }

                    C Offline
                    C Offline
                    campbells
                    wrote on last edited by
                    #9

                    pls refer to mr_lasseter response , i have try many way of those format. but when i save a new record it able to save it but when update , which mean edit the old record then have problem.

                    C M 2 Replies Last reply
                    0
                    • C campbells

                      pls refer to mr_lasseter response , i have try many way of those format. but when i save a new record it able to save it but when update , which mean edit the old record then have problem.

                      C Offline
                      C Offline
                      Colin Angus Mackay
                      wrote on last edited by
                      #10

                      Guffa's questions are valid. From the last attempt that you made: Standard question #1: What do you mean by "not working"? Standard question #2: What error message do you get?


                      Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

                      1 Reply Last reply
                      0
                      • C campbells

                        pls refer to mr_lasseter response , i have try many way of those format. but when i save a new record it able to save it but when update , which mean edit the old record then have problem.

                        M Offline
                        M Offline
                        mr_lasseter
                        wrote on last edited by
                        #11

                        I would use the debugger to step the code and see what the update string that is sent to the database looks like. I would take this string and try to run it as a query in access. Figure out what you need to do to the string in order to get it to run in Access, then make the appropriate changes in your code.

                        Mike Lasseter

                        1 Reply Last reply
                        0
                        • C campbells

                          i had found my error which is the DATE cause the problem... anyway to update my DATE field?? will it becasue of the format? because i found out that my vb when i put"NOW" it will include the time with it. But with my access i had set it as DATE only. Date= " & "'" & ddate.Text & "'" & _ Here my full coding: DB.Execute "update DONO set NO=" & "'" & dono.Text & "'" & _ ",Date= " & "'" & ddate.Text & "'" & _ ",Customer=" & "'" & Combo1.Text & "'" & _ ",Description =" & "'" & ddes.Text & "'" & _ ",Total =" & "'" & temptotal.Caption & "'" & _ ",BillTerm=" & "'" & dterm.Text & "'" & _ " where [dono] = " & "'" & userin & "'"

                          R Offline
                          R Offline
                          Roy Heil
                          wrote on last edited by
                          #12

                          Can you do something like this? Date= " & "'" & Now.ToShortDateString & "'" & _

                          Roy.

                          C 1 Reply Last reply
                          0
                          • R Roy Heil

                            Can you do something like this? Date= " & "'" & Now.ToShortDateString & "'" & _

                            Roy.

                            C Offline
                            C Offline
                            campbells
                            wrote on last edited by
                            #13

                            having error : Object require.

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups