Results 1 to 20 of 20

Thread: [RESOLVED] Format() function not working at all

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    [RESOLVED] Format() function not working at all

    I've recently returned to VB6 and am having an issue with the Format() function. I wrote a program years ago and it worked correctly then. When I try to run it now it gives me that compile error "can't find library" at all the Format functions.

    An example of how I'm using it is like so:
    string = "C: " + Format(getHDUsed, "###,.00") + " GB"

    I'm thinking that I'm missing some kind of add-in or library but I don't know which is associated with the Format function. Nor do I even remember how to install add-ins or libraries. If anyone could help me with this, it would be much appreciated.
    Last edited by FanGuy; May 2nd, 2007 at 12:57 AM.

  2. #2
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: Format() function not working at all

    Change + to &

    And if still problems, try a simpler Format instruction and see how that goes
    Rob C

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: Format() function not working at all

    Quote Originally Posted by RobCrombie
    Change + to &

    And if still problems, try a simpler Format instruction and see how that goes
    Thanks for responding.

    Ive already tried + to & that doesn't seem to be the issue.

    Format() is used thoughout the program and it seems like it doesn't want to work anywhere. Some examples are more simple than others.

  4. #4
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: Format() function not working at all

    vb Code:
    1. Private Sub Form_Click()
    2.   Me.Print Format(Date, "yyyy mmm d")
    3. End Sub

    Does that work on your pc (it works on mine)
    Rob C

  5. #5
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: Format() function not working at all

    Are your Project References like this (ignore the highlighting)
    Attached Images Attached Images  
    Rob C

  6. #6
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Format() function not working at all

    Did you put any reference? Check for MISSING OCX / LIBRARY in the reference and uncheck it. It may be deleted from the windows system32 folder.

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: Format() function not working at all

    It looks like this: (These are the ones checked off)

    Visual Basic For Applications
    Visual Basic runtime object and procedures
    Visual Basic objects and procedures
    OLE Automation
    Messenger API Type Library
    Windows Media Player
    Windows Media Player
    Windows Media Player
    Messenger Type Library
    Messenger Private Type Library
    MISSING: Messenger Addins Type Library

    And the the rest that are not checked
    Last edited by FanGuy; May 1st, 2007 at 11:49 PM. Reason: Could not post image

  8. #8
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: Format() function not working at all

    If you are having trouble attaching the image, you can send it to me -
    robhp AT iprimus DOT com
    Rob C

  9. #9
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: Format() function not working at all

    In the meantime.
    All the ticks in my image are normally there in every VB6 project.
    So go ahead and ensure they are ticked in your project.

    Whilst you are solving this, you should be doing it in a tiny stand alone example.
    Once you get that working, then go back to your larger project.
    Rob C

  10. #10

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: Format() function not working at all

    Quote Originally Posted by RobCrombie
    In the meantime.
    All the ticks in my image are normally there in every VB6 project.
    So go ahead and ensure they are ticked in your project.

    Whilst you are solving this, you should be doing it in a tiny stand alone example.
    Once you get that working, then go back to your larger project.
    will do thanks for all your help. This is something that I'm scratching my head over.

  11. #11
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: Format() function not working at all

    Try running the attached
    Attached Files Attached Files
    Rob C

  12. #12

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: Format() function not working at all

    Quote Originally Posted by RobCrombie
    vb Code:
    1. Private Sub Form_Click()
    2.   Me.Print Format(Date, "yyyy mmm d")
    3. End Sub

    Does that work on your pc (it works on mine)
    Sorry I didn't respond to this right away. This works when I open a new project. Even this works:
    Code:
    Private Sub Form_Click()
      Me.Print Format("123456789", "###,.00")
    End Sub
    But when I add it to my already existing project, it doesn't work. It gives me the same error.

  13. #13
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: Format() function not working at all

    We have not seen an image of your References dialog

    (VB can get huffy when there is a different problem elsewhere)
    Last edited by RobCrombie; May 2nd, 2007 at 12:20 AM.
    Rob C

  14. #14

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: Format() function not working at all


  15. #15
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: Format() function not working at all

    Yup, probably that missing reference is confusing VB
    Attached Images Attached Images  
    Last edited by RobCrombie; May 2nd, 2007 at 12:33 AM.
    Rob C

  16. #16
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: Format() function not working at all

    Quote Originally Posted by FanGuy
    MISSING: Messenger Addins Type Library
    this the thing that causes the problem...if you know that you are using the functions from this library then browse it, else just remove this and you should get other errors, but it will not stop on the format function.
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  17. #17

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: Format() function not working at all

    That was it!!!! I just unchecked the MISSING. It work perfectly now just like I remember.
    Thanks so much.

    Now how do I mark this as RESOLVED?

  18. #18
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Format() function not working at all

    Quote Originally Posted by FanGuy
    That was it!!!! I just unchecked the MISSING. It work perfectly now just like I remember.
    Thanks so much.

    Now how do I mark this as RESOLVED?
    You did missed reading post #6 right?

  19. #19

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    8

    Re: Format() function not working at all

    Quote Originally Posted by zynder
    You did missed reading post #6 right?
    Yes, I gues I did.

  20. #20
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: [RESOLVED] Format() function not working at all

    Click the thread tools and Mark thread resolved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width