Results 1 to 3 of 3

Thread: Is there a better way to do this?

  1. #1

    Thread Starter
    Fanatic Member The_Grudge's Avatar
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    836

    Is there a better way to do this?

    I have a listbox on my form that is populated by data from Microsoft Access using a query/recordset. This query returns about 6 fields which include employee "FirstName" and "LastName" and "ID" which is a unique identifier.

    Through code I make the entries in the listbox look like this...

    Cruise, Tom
    Gates, Bill
    Gretzky, Wayne
    Nicholson, Jack

    and so on. This works perfectly.

    I then allow the user to drag & drop names from this listbox onto a schedule on the same form that consists of about 55 textboxes.
    The problem is that the listbox only contains the first & lastname of the employee because that's all I want the user to see. However, once a name is dropped into a textbox I need more information than simply lastname or firstname. I need the ID as well.

    What I'm currently doing works fine but there has to be a better way.
    Right now, once a name is dropped into a textbox I take the last name and do a ".Find" to find the record in the recordset I'm looking for. Then I have access to all the other info I need. It just seems silly to be manipulating strings and constantly searching for records. Maybe this is a good way, I don't know.

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

    Re: Is there a better way to do this?

    Store the ID into the listbox's ItemData, then use that for more precision
    Rob C

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Is there a better way to do this?

    Regardless of how you do it, searching for information relevant to the name being dropped is going to have to occur, so I don't see anything wrong with how you are doing it.

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