CStr$ Function in Office 2007

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Icarus

    CStr$ Function in Office 2007

    My database, built in Access 2000 but opened in Access 2007 does not
    seem to like the function CStr$ (with the dollar sign after), and
    gives me an error message. However, if I change the function to CStr
    (no dollar sign), I don't get the error message anymore. Does anyone
    know why this would happen?
  • lyle fairfield

    #2
    Re: CStr$ Function in Office 2007

    On Aug 25, 1:22 pm, Icarus <tjmos...@gmail .comwrote:
    My database, built in Access 2000 but opened in Access 2007 does not
    seem to like the function CStr$ (with the dollar sign after), and
    gives me an error message.  However, if I change the function to CStr
    (no dollar sign), I don't get the error message anymore.  Does anyone
    know why this would happen?
    My guess is that it's directly related to a USA national debt of 9
    trillion 600 billion dollars.

    Comment

    • Icarus

      #3
      Re: CStr$ Function in Office 2007

      On Aug 25, 4:29 pm, lyle fairfield <lyle.fairfi... @gmail.comwrote :
      On Aug 25, 1:22 pm, Icarus <tjmos...@gmail .comwrote:
      >
      My database, built in Access 2000 but opened in Access 2007 does not
      seem to like the function CStr$ (with the dollar sign after), and
      gives me an error message.  However, if I change the function to CStr
      (no dollar sign), I don't get the error message anymore.  Does anyone
      know why this would happen?
      >
      My guess is that it's directly related to a USA national debt of 9
      trillion 600 billion dollars.
      That is strange. I thought it might be a reference library issue, or
      maybe a corrupt database. Who knew that the national debt was
      imacting my query design!

      Comment

      • lyle fairfield

        #4
        Re: CStr$ Function in Office 2007

        I'm pretty sure it's CStr€() now. If not it soon will be. The dollar
        sign will be used for a new conversion function TwoBit$() which will
        convert American dollars to their real value.

        On Aug 25, 4:58 pm, Icarus <tjmos...@gmail .comwrote:
        On Aug 25, 4:29 pm, lyle fairfield <lyle.fairfi... @gmail.comwrote :
        >
        On Aug 25, 1:22 pm, Icarus <tjmos...@gmail .comwrote:
        >
        My database, built in Access 2000 but opened in Access 2007 does not
        seem to like the function CStr$ (with the dollar sign after), and
        gives me an error message.  However, if I change the function to CStr
        (no dollar sign), I don't get the error message anymore.  Does anyone
        know why this would happen?
        >
        My guess is that it's directly related to a USA national debt of 9
        trillion 600 billion dollars.
        >
        That is strange.  I thought it might be a reference library issue, or
        maybe a corrupt database.  Who knew that the national debt was
        imacting my query design!

        Comment

        • Icarus

          #5
          Re: CStr$ Function in Office 2007

          On Aug 25, 7:15 pm, lyle fairfield <lyle.fairfi... @gmail.comwrote :
          I'm pretty sure it's CStr€() now. If not it soon will be. The dollar
          sign will be used for a new conversion function TwoBit$() which will
          convert American dollars to their real value.
          >
          On Aug 25, 4:58 pm, Icarus <tjmos...@gmail .comwrote:
          >
          On Aug 25, 4:29 pm, lyle fairfield <lyle.fairfi... @gmail.comwrote :
          >
          On Aug 25, 1:22 pm, Icarus <tjmos...@gmail .comwrote:
          >
          My database, built in Access 2000 but opened in Access 2007 does not
          seem to like the function CStr$ (with the dollar sign after), and
          gives me an error message.  However, if I change the function to CStr
          (no dollar sign), I don't get the error message anymore.  Does anyone
          know why this would happen?
          >
          My guess is that it's directly related to a USA national debt of 9
          trillion 600 billion dollars.
          >
          That is strange.  I thought it might be a reference library issue, or
          maybe a corrupt database.  Who knew that the national debt was
          imacting my query design!
          Wonderful.

          Does anyone have a CONSTRUCTIVE answer now?

          Comment

          • lyle fairfield

            #6
            Re: CStr$ Function in Office 2007

            Destructively speaking, I can attest that there is no CStr$ function
            in my copy of Access2007/VBA. This is scarcely surprising as
            CStr(Expression ) returns a string.
            My copy of Access2000 is exactly the same. The CStr$ function does not
            exist.

            If I type
            Debug.Print CStr$(3)
            the code editor changes the line to
            Debug.Print CStr(3)

            So? I see you did not actually assert that CStr$ worked swimmingly in
            Access 2000. Does it? If so, is Option Explicit set? Is Break On Error
            set? Is it running after a On Error Resume Next directive? Can you
            post the whole procedure where it is used so that we may paste it into
            Access 2000 and examine how it works? Have you installed Service Pack
            817 for Access 2000?

            On Aug 25, 7:37 pm, Icarus <tjmos...@gmail .comwrote:
            Does anyone have a CONSTRUCTIVE answer now?

            Comment

            • Icarus

              #7
              Re: CStr$ Function in Office 2007

              It is actually part of a query:

              TicketNum: CStr$(Trim$([Ticket Number]))

              Comment

              • Keith Wilby

                #8
                Re: CStr$ Function in Office 2007

                "Icarus" <tjmoses1@gmail .comwrote in message
                news:b5f373b0-cec1-4f15-84d3-a9a77d94c668@v1 6g2000prc.googl egroups.com...
                It is actually part of a query:
                >
                TicketNum: CStr$(Trim$([Ticket Number]))
                FWIW, in 15 years of developing in Access (v2 onwards) I've *never* used the
                $ sign in a VBA function.

                Keith.


                Comment

                • Icarus

                  #9
                  Re: CStr$ Function in Office 2007

                  On Aug 26, 9:45 am, "Keith Wilby" <h...@there.com wrote:
                  "Icarus" <tjmos...@gmail .comwrote in message
                  >
                  news:b5f373b0-cec1-4f15-84d3-a9a77d94c668@v1 6g2000prc.googl egroups.com...
                  >
                  It is actually part of a query:
                  >
                  TicketNum: CStr$(Trim$([Ticket Number]))
                  >
                  FWIW, in 15 years of developing in Access (v2 onwards) I've *never* used the
                  $ sign in a VBA function.
                  >
                  Keith.www.keithwilby.com
                  I'm in total agreement that it is not necessary, I'm just curious what
                  is special about Office 2007 that would make it stop working, while
                  previous versions of Access seem to allow it.

                  Comment

                  • Keith Wilby

                    #10
                    Re: CStr$ Function in Office 2007

                    "Icarus" <tjmoses1@gmail .comwrote in message
                    news:38de2b6b-6b25-42e2-b0d2-0c202682fd4d@b3 0g2000prf.googl egroups.com...

                    <snip>

                    I must admit I've never even considered it, but having just tried it, it
                    does work in A2k3. Not a jot of use to you but is news to me :-)

                    Keith.

                    Comment

                    • Icarus

                      #11
                      Re: CStr$ Function in Office 2007

                      On Aug 26, 10:11 am, "Keith Wilby" <h...@there.com wrote:
                      "Icarus" <tjmos...@gmail .comwrote in message
                      >
                      news:38de2b6b-6b25-42e2-b0d2-0c202682fd4d@b3 0g2000prf.googl egroups.com...
                      >
                      <snip>
                      >
                      I must admit I've never even considered it, but having just tried it, it
                      does work in A2k3.  Not a jot of use to you but is news to me :-)
                      >
                      Keith.
                      I just need to update the queries where CStr$ was used to reflect that
                      it no longer works. Not a big deal.

                      Comment

                      • Phil Stanton

                        #12
                        Re: CStr$ Function in Office 2007

                        Check out the Trim$ as well Trim is wot I use, but I'm a lousy typist so why
                        add extra symbols.

                        Phil
                        "Icarus" <tjmoses1@gmail .comwrote in message
                        news:b5f373b0-cec1-4f15-84d3-a9a77d94c668@v1 6g2000prc.googl egroups.com...
                        It is actually part of a query:
                        >
                        TicketNum: CStr$(Trim$([Ticket Number]))

                        Comment

                        • Sky

                          #13
                          Re: CStr$ Function in Office 2007

                          "Icarus" <tjmoses1@gmail .comwrote in message
                          news:b5f373b0-cec1-4f15-84d3-a9a77d94c668@v1 6g2000prc.googl egroups.com...
                          It is actually part of a query:
                          >
                          TicketNum: CStr$(Trim$([Ticket Number]))
                          In Access 2003, the Trim$() function only accepts strings and returns
                          string, whereas Trim() will accept a Null and propagate the Null through.
                          Other functions are similar, such as Left$ and Left, or Right$ and Right.

                          In a query, Trim() is probably safer unless it is positively known there are
                          no nulls. Perhaps the $ variations of these string functions are
                          undetectably faster, if you know there are no nulls.

                          The string conversion function CStr() does not accept Nulls in Access 2003,
                          so it seems there is no reason to have CStr$(). Both work, but neither
                          accepts nulls. Perhaps they removed CStr$ in Access 2007.

                          - Steve



                          Comment

                          Working...