Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Jan 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    New line generated with comma (Access 2000)

    I select an item or items from a multiple-select list box (a product description) and click on an ADD button which places the selected item(s) in another list box on the same form ... Works well EXCEPT .. if the product description has a comma (e.g. water tank 10,000 litres) it creates a new line in the other list box wherever a comma occurs ???

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: New line generated with comma (Access 2000)

    I suppose that the rowsource of the listbox a value list is.
    To add an item with a comma in it, you have to surround it with quotes.

    MyString = "water tank 10,000 litres"
    MyListbox.RowSource = MyListbox.RowSource & "," & Chr(34) & MyString & Chr(34)
    Francois

  3. #3
    New Lounger
    Join Date
    Jan 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: New line generated with comma (Access 2000)

    Thanks Francois --
    I need the comma in the 10,000 part of the string e.g.
    List A : "Water tank 10,000 litres"
    when it gets to list B I get:
    Water tank 10
    000 litres.
    Where the comma is in the string from list A it actually deletes the comma and inserts a CR/LF !
    If I have five commas in the string in list A I get six (6) lines all split at the comma.
    I don't particulary want to re-write all the strings looking for commas and concatenating the string portions together ???

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: New line generated with comma (Access 2000)

    How do you move an item from List A to List B ?
    Francois

  5. #5
    New Lounger
    Join Date
    Jan 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: New line generated with comma (Access 2000)

    Francois

    please see code attached --- this is in the click event of an "Add" button on the form ..

    cheers

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: New line generated with comma (Access 2000)

    Francois is not online at the moment. He already told you the solution in his first reply: you must surround the items you add to the Row Source of the "current" list box with quotes. See attached modified code.

  7. #7
    New Lounger
    Join Date
    Jan 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: New line generated with comma (Access 2000)

    Hans,

    Thanks v. much ... I misread Francois' 1st reply ..

    Francois ... thanks v. much to you too.

Posting Permissions

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