Listbox click update other listbox

pser

Registered User.
Local time
Today, 15:37
Joined
May 21, 2002
Messages
32
Hey, i have problem getting something to work. It's like this i have a listbox person and if i click i want to list what is register on that particular person in another listbox. I have something which work, but i have to click a button in order to update the other listbox. I want to update other listbox only by click in listbox person.

Solution right now are like this:

I'm using a temp hidden textbox which contain unique id for a person which is selected. So when i click show person, the hidden textbox get's the unique id and then i do a requery for the query in the other listbox.

Query behind the other listbox:
SELECT PersonFrynse.Personnr, Frynsegode.Beskrivelse FROM Frynsegode INNER JOIN PersonFrynse ON Frynsegode.FryID=PersonFrynse.FryID WHERE (((PersonFrynse.Personnr)=Forms.PersonFrynsegode.Personnr));

Any suggestion?

Pser
 
Yes, maybe you misunderstod me. The two listbox works fine but i've got this extra click on the button show detail for particualr person. What i'm looking for is to get update after just click on the person listbox.

The thing which doesn't work is in this code:

Dim ctlSource As Control
Set ctlSource = Me!Person
For IntCurrentRow = 0 To ctlSource.ListCount - 1
If ctlSource.Selected(IntCurrentRow) Then
Me!Personnr.Value = strItems & ctlSource.Column(0, IntCurrentRow)
End If
Next IntCurrentRow
Me!Valgte.Requery

This code work fine behind a button, but not behind the onclick of the list box. If i click a record in listbox i don't get anything selected.

Pse
 
I've solved it. Solution is like this and it's so simple.

ctlSource.ItemData(ctlSource.ListIndex)

Pse
 

Users who are viewing this thread

Back
Top Bottom