Format function problems

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CD Tom
    Contributor
    • Feb 2009
    • 495

    Format function problems

    I'm having a problem with some customers having a Function error when they run any thing with the Format function in it. The code is
    Code:
    YEAR: (Format([Params.shoot_date],"yyyy"))
    I run it on my machine with not problems. I've also loaded the program onto a customers computer that has Access and if I look at the references I see no broken ones. If I run the program in Access the format function works. If I run it in the runtime using the .accdr It comes up with the error. It's not just the Year: format that has problems it's anything that uses the Format function. Does anybody have any idea what's happening or what I can do to fix this issue.

    Thanks for any help.
  • PhilOfWalton
    Recognized Expert Top Contributor
    • Mar 2016
    • 1430

    #2
    I have heard of this problem before, and there is a suggestion that you could have say version 2016 runtime and Office 2010 (with or without Access) installed on the same machine, giving some sort of incompatibility .

    I can contribute nothing further on this topic, as I have never used Runtime. Might be worth checking out though

    Phil

    Comment

    • twinnyfo
      Recognized Expert Moderator Specialist
      • Nov 2011
      • 3664

      #3
      Tom,

      First, try a compact and repair of your DB. See if that works. If not, a more extreme, but often helpful, method is to create a new, blank DB and import all objects into that new DB. Compact and Repair, Compile and see if you get the same results.

      Please refer to a similar post concerning Access producing strange and unexplainable errors.

      Let us know if that hepps!

      Comment

      • CD Tom
        Contributor
        • Feb 2009
        • 495

        #4
        Does anybody know which reference is used for the Format function. I thought I might look and replace the reference with a newer or older one.
        It's funny that when I run the program with Access 2010 it works but when I run the Runtime it doesn't. I might try uninstalling the Access 2010 and see if that helps.
        I have installed Office 365 on one of the machines that was giving me this problem and after it was installed the Access 2007 runtime worked. Strange!

        Thanks

        Comment

        • twinnyfo
          Recognized Expert Moderator Specialist
          • Nov 2011
          • 3664

          #5
          Tom,

          AFAIK, the Format() function is a standard function. No reference is needed. Others, please correct me if I am wrong.

          If you were trying to automate Excel betwixt different versions of MS Office, I would expect the references to be updated (although you can get around this by declaring those apps explicitly).

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32662

            #6
            Originally posted by CD Tom
            CD Tom:
            Does anybody know which reference is used for the Format function.
            It's the VBA library Tom.

            If you're ever curious simply go to The Immediate Pane (Ctrl-G) and type the name of the function you want to know about. Once you have the name there simply open The Object Browser Pane (F2) and you should see your Method in the right-hand pane and the Class in the left. Below both panes is the summary info which includes the full path to the class it's a Member of (The first element of which will always be the library name).

            Comment

            • twinnyfo
              Recognized Expert Moderator Specialist
              • Nov 2011
              • 3664

              #7
              NeoPa,

              So, if I understand correctly, "technically speaking" the Format() Function requires the reference to the VBA Library; but, without that reference, you can't program in VBA anyway, so, it's kind of moot?

              But, at least now I know how to find what goes with which reference.

              Thanks!

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32662

                #8
                Originally posted by TwinnyFo
                TwinnyFo:
                So, if I understand correctly, "technically speaking" the Format() Function requires the reference to the VBA Library; but, without that reference, you can't program in VBA anyway, so, it's kind of moot?
                That's not quite right my friend.

                VBA is a language. It comes with an IDE (Integrated Development Environment) as well as a library of Classes including Methods and other Properties. This particular library is not deselectable from the IDE interface so there's a certain truth in saying they're tied together, but it can also be available for non-VBA use.

                The situation where the library is deselected cannot cause VBA to be unusable. It isn't an available option anyway, but if it were, it still wouldn't cause VBA to fail. It would only cause calls to any of the items within that particular library to fail. Does that make sense?

                Obviously most VBA code uses that library very heavily so it's been set as non-deselectable.

                Comment

                • twinnyfo
                  Recognized Expert Moderator Specialist
                  • Nov 2011
                  • 3664

                  #9
                  AS usual.... I continue to learn new things about this stuff.

                  :-)

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32662

                    #10
                    We all do. We all do :-)

                    Comment

                    Working...