Code Question

D

DS

I have a form with a Listbox on it. What I want to happen is...
If the Listbox has only one Item in it. I want that Item to be selected
and the form closed and the next form opens.
The whole thing works now...except I have to select that item manually.
I don't have a clue how to do this ?!?
Any help is appreciated.
Thanks
DS
 
S

Steve Schapel

DS,

Something along these lines?...

If Me.YourListbox.ListCount = 1 Then
Me.YourListbox.Selected(0) = True
End If
Then run the code that presumably refers to the value of the listbox
in the opening of the other form... you will need to provide more
detailed information if you need more explicit help with this aspect.
 
D

DS

Steve said:
DS,

Something along these lines?...

If Me.YourListbox.ListCount = 1 Then
Me.YourListbox.Selected(0) = True
End If
Then run the code that presumably refers to the value of the listbox in
the opening of the other form... you will need to provide more detailed
information if you need more explicit help with this aspect.
Thanks,
Basically I'm opening this form from another form and if it has only one
reord to select in it, I'm bypassing it forthe user, this way the value
gets set to the next form without the user having to stop and click on
just one record. The form with the one record picks the items that fill
the listbox on the next form...I should be able to take it from here!
Once again thank you!
DS
 
D

DS

DS said:
Thanks,
Basically I'm opening this form from another form and if it has only one
reord to select in it, I'm bypassing it forthe user, this way the value
gets set to the next form without the user having to stop and click on
just one record. The form with the one record picks the items that fill
the listbox on the next form...I should be able to take it from here!
Once again thank you!
DS


Steve,
It worked great! So now when the user has only one choice they don't
have to make a decision....they only have to deal with it when theres
more than one.
Thanks
DS
 

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