List boxes and Comb Boxes

B

BrianPaul

I have a list box called "list102" on a form called "MainForm" and I would
like to use the double click event property on "list102" on the "MainForm" to
hyperlink to another form called "TeamMenuPopup" and automatically fill in a
combo box named "combo 78" on the "TeamMenuPopup" form. I have tried using
other codes and have failed.

Thanks.
 
P

pietlinden

I have a list box called "list102" on a form called "MainForm" and I would
like to use the double click event property on "list102" on the "MainForm" to
hyperlink to another form called "TeamMenuPopup" and automatically fill in a
combo box named "combo 78" on the "TeamMenuPopup" form. I have tried using
other codes and have failed.

Thanks.

why not just use a combobox? Listboxes are harder to work with,
because they have an ItemsSelected collection instead of a single
value.. Unless you really need to be able to select multiple items,
I'd use a combobox... but here's some code that might help...

Private Sub List0_DblClick(Cancel As Integer)
Dim varItem As Variant
For Each varItem In Me.List0.ItemsSelected
'---just an example... put your code here to process the
value(s)
MsgBox Me.List0.ItemData(varItem)
DoCmd.OpenForm "MyForm",, [SomeField]=varItem
Exit For ' cheat and process only one item...
Next varItem
End Sub

If you set the multi-select property to None, you should be okay. ..
Otherwise, it won't act like a combobox.

"Other codes have failed"? Like which? Eliminate as many contenders
up front if you really want people to help (make it EASY on them).
e.g., "I am trying to accomplish X. I have tried {option 1, option
2,...}
Did you try a combobox? That would be much easier - just code for the
Changed event.
 
B

BrianPaul

I have a list box called "list102" on a form called "MainForm" and I would
like to use the double click event property on "list102" on the "MainForm" to
hyperlink to another form called "TeamMenuPopup" and automatically fill in a
combo box named "combo 78" on the "TeamMenuPopup" form. I have tried using
other codes and have failed.

Thanks.

why not just use a combobox? Listboxes are harder to work with,
because they have an ItemsSelected collection instead of a single
value.. Unless you really need to be able to select multiple items,
I'd use a combobox... but here's some code that might help...

Private Sub List0_DblClick(Cancel As Integer)
Dim varItem As Variant
For Each varItem In Me.List0.ItemsSelected
'---just an example... put your code here to process the
value(s)
MsgBox Me.List0.ItemData(varItem)
DoCmd.OpenForm "MyForm",, [SomeField]=varItem
Exit For ' cheat and process only one item...
Next varItem
End Sub

If you set the multi-select property to None, you should be okay. ..
Otherwise, it won't act like a combobox.

"Other codes have failed"? Like which? Eliminate as many contenders
up front if you really want people to help (make it EASY on them).
e.g., "I am trying to accomplish X. I have tried {option 1, option
2,...}
Did you try a combobox? That would be much easier - just code for the
Changed event.


Sorry, Code wasnt helpful at all. If I can get the correct code then when the form is open and combo box is filled in then It will let me use the oncurrent event. I could list all the codes that I have used to try and get it to work. but there would be about 100 lines of code. Thanks for the reply at least you gave it a shot. This is not a multiple select list box or multiple list combo box. I already have codes for both of them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top