List box to list box

iain1978

Registered User.
Local time
Today, 00:08
Joined
Nov 26, 2004
Messages
30
Hi,

I'm having a problem that is really making me want to pull my hair out. I'm also new to VB so please be gentle.

Down to my problem. I have two list boxes . The first one (List4) gets it data from a query that runs after a refresh even after an update to a combo box (the different option on the comb box will result in different lists in the List4.

I have a second list box List40 that currently holds no data. What I want to do is to be able to click on items that are displayed on List4 after the combo box is selected and for them to be updated in List40 (I hope this is making sense to you).

From looking around the forum I have discovered a couple of threads that are after the same thing and wrote a small bit of code (below) but I get a sub or function not defined error. Can anyone tell me where I have gone wrong as these seams like a simple enough task for access to perform.

Thanks in advance

Private Sub List4_DblClick(Cancel As Integer)
Dim MyItems As String
Me.List40.RowSourceType = "Value List"
MyItems = RowSource(Me.List4, 1)
Me.List40.RowSource = MyItems
End Sub
 
Try this:
Combo box - AfterUpdate Event
Code:
'Transfer Row source if necessary
Me.List4.RowSourceType = "Table/Query"
Me.List4.RowSource = " ... " 

'Refresh the control
Me.List4.Requery
 
First of all thanks for the help.

I have tried to use the code you suggested but all that happens is the list4 box losses the entire list and the information is not paassed over to list40.

Thanks anyway though
 
Why don't you post an example of what you have already?
 

Users who are viewing this thread

Back
Top Bottom