Decimal separator in Access database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mpernic
    New Member
    • Nov 2007
    • 5

    Decimal separator in Access database

    Hello all!

    Situation is as follows:
    - Access database file, decimal field (18,2)
    - Visual Basic 2005
    - ADO connection

    When I put Datagrid on the form, I see the value correctly, and I can change it.
    But, when I try to put a textbox on another form, referencing to the same data, the data reads correctly (for example: 1,23), but when I change it (to for example: 4,56) and save it, it saves as (456) in the database.
    Regional settings are set to Croatian in Windows, and Dataset locale is set to hr-HR.

    Anybody has a clue what should I do?

    Thanks a lot in advance!

    Marko
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Do you have Comma "," as Decimal Seperator...?

    Regards
    Veena

    Comment

    • mpernic
      New Member
      • Nov 2007
      • 5

      #3
      Hi Veena.

      Yes, I forgot to state. I have comma as decimal separator.

      Marko

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Hi,

        If your TextBox, is Bound To dataSource, then
        You can Set the DataFormat, in PropertySheet >Databinding Advanced
        set it to Numeric.
        Or else, While Saving to Database, use
        CDec(TextBox1.T ext)
        CDec Converts the Contents to Decimal Format..

        Regards
        Veena

        Comment

        • mpernic
          New Member
          • Nov 2007
          • 5

          #5
          Great, thanks, will try that and let you know if it works.

          Comment

          • mpernic
            New Member
            • Nov 2007
            • 5

            #6
            Hi again.

            Ive set the property to Numeric and I got data type mismatch. Then Ive changed the data type from Decimal to Double in Dataset (.xsd file). Tryed again, and everything is like I never changed anything: I enter 1,23, and I get 123 in the database.
            Ive checked the content of dataset.designe r.vb file, and the data types are correct.

            I've checked with CDec and I get 1,23 when I msgbox it. Ive also tryed with NumericUpDown control, and I also get 123 in the database. The other fields update normaly and correctly.

            Are there any other things I could check? Any idea?

            Marko

            Comment

            • QVeen72
              Recognized Expert Top Contributor
              • Oct 2006
              • 1445

              #7
              Hi,

              As you say CDec works Fine, Let me know how you are updating the dataset from textbox..?
              post your code here..

              Regards
              Veena

              Comment

              • mpernic
                New Member
                • Nov 2007
                • 5

                #8
                I still havent solved the problem, so if anyone knows, help would be very appreciated.
                Thanks!

                Comment

                Working...