Results 1 to 5 of 5

Thread: *RESOLVED* Variables returned from a Class Property & Database

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2003
    Posts
    22

    *RESOLVED* Variables returned from a Class Property & Database

    Made a post last week before i left work, but its dissapeared.

    Im using a Class module to call up a Open File dialog and copy the address selected to a variable. This is in Access VB.

    The user picks a jpg file, presses ok and a msgbox pops up with the path. This seems ok.

    However, when i put the Class property variable into a normal variable, and then subsequently into the data field, it gives me data too large.

    Code:-

    strImagePath = cdlg.GetName
    Me.SurveyImageLocation = strImagePath

    Just had a quick look at a file with a short path so that i could see if there was anything at the end of the path, and there seems to be a LOT of SQUARE BOX - like characters that almost look like spaces!

    Is there a way i can clean these up? This would probably fix it. Perhaps putting a limit on the string variable's characters would do it, or preferrably, some code that strips any characters at the end of the path.
    Last edited by Kinsy; Jul 14th, 2003 at 08:58 AM.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Jul 2003
    Posts
    22
    Ive set a limit to 240 characters for the time being, and this works.

    However id still like to get rid of all those spaces at the end.

    Any ideas?

  3. #3
    Addicted Member
    Join Date
    Mar 2003
    Location
    Minneapolis, MN
    Posts
    151
    See the Trim, LTrim, and RTrim functions.

    Trim takes care of leading and trailing spaces.
    LTrim takes care of leading spaces.
    RTrim takes care of trailing spaces.

  4. #4
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    You might also try this
    VB Code:
    1. strImagePath = Replace(cdlg.GetName, Chr(0), "")

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jul 2003
    Posts
    22
    Works great, thanks guys

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