Results 1 to 3 of 3

Thread: Dlookup (2000)

  1. #1
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dlookup (2000)

    Hi, I have a combo box (query) that shows the names of the queries, the ID number is hidden. I have a text box (referrals) that needs to contain the query types selected from the combo, thus say query XXX is selected in the combo, XXX is shown in the text box then suppose query YYY is selected, YYY shows in the list box below XXX and so on. The problem I have is that my code on the after update event on the cmb box works but instead of XXX an YYY showing in the text box, 1 and 2 show i.e. the IDs for XXX and YYY are displayed. I believe I can remedy this with dlookup but I am not confident in using. The code on the event is currently:

    Private Sub cmb_AfterUpdate()

    text = (text + vbCrLf) & cmb

    End Sub

    Thank U Darren.

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

    Re: Dlookup (2000)

    You can refer to a specific column of a combo box. You want to refer to the second column (the first is the hidden ID column). The column index starts at 0, so the second column has index 1. Try

    text = (text + vbCrLf) & cmb.Column(1)

  3. #3
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dlookup (2000)

    Much obliged Hans, thanks again.

Posting Permissions

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