Results 1 to 7 of 7
  1. #1
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Show more than 1 record in a text box (97/2K)

    I have an unbound text box on a form which displays the treatment history obtained by a query. However, when the query contains more than 1 value, only the first value is displayed.
    How can I display all values or do I need to use a different method?

    Rob
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Show more than 1 record in a text box (97/2K)

    Hi Rob,

    You can use several techniques to accomplish this. Perhaps the easiest is to use a List box instead of a Text box. Make sure it's unbound and then set its row source to the desired query.

    If you must use a text box, you'll need to use code. You'll want to use either ADO or DAO to loop through a recordset (based on the query) and add the value to a string variable. Then, assign the string to the textbox's value property. You'll probably want to use comma or semicolon to separate the items. Post back if you decide to do it this way and need help.

    Hope this helps!

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Show more than 1 record in a text box (97/2K)

    Another option is to put the textbox into a small continuous subform. This will be able to show all the relevant entries from the history.
    Regards
    John



  4. #4
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Show more than 1 record in a text box (97/2K)

    Thanks Mark for the quick reply and offer of further help. I would imagine that the list box option would require the user to click the arrow to view the list. While this is perfectly acceptable, if a box could show a list of previous treatments without further input from the user, it would be more aesthetically pleasing. Also it would challenge and inform me. If you would expand on your second option, I would be extremely grateful.

    Rob
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  5. #5
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Show more than 1 record in a text box (97/2K)

    I think you're mistaking a Listbox for a Combo Box (or drop-down). The list box is a fixed size and does not drop down. This is probably your best bet.

    Although, John's suggestion of a continuous subform is also a great idea - why didn't I think of that <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Post back if you need further assistance.

  6. #6
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Show more than 1 record in a text box (97/2K)

    Good grief! That was quick.
    Thanks Mark and John.
    Yes Mark, I was confused but shouldn't have been. And John, I had played with the subform idea but I couldn't quite get it right.
    Perhaps you could help with both ideas in order to further my education.
    Secondly, if you could take a look at my previous post (200965) regarding the mysterious behaviour of a subform, my grate will never be so full.

    Many thanks,

    Rob
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  7. #7
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Show more than 1 record in a text box (97/2K)

    Rob
    I have posted a rely to your other post, and it may help you work out what is wrong with your history subform too.
    Regards
    John



Posting Permissions

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