Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox Item Highlighted after returning from a Form

Status
Not open for further replies.

eavan

Technical User
Aug 6, 2003
51
GB
Hi,

I make a selection in a listbox (test case list) and press a command button which brings me to another form (test case).But when i save the changes on the the (test case) form then i return to the (test case list)form.I was hoping to have the item previously selected to remain selected in the listbox. Does anyone know? Thanks a mill
 
do you close the original form at any point?

if not, then the form should keep the selection, although the focus might be lost from the listbox, so just refocus.

however if you close the original form, then the only way to do this is to save the selected value to a global variable, and then when you open the original form again, to look at the global variable and programatically select the right item on the list.

--------------------
Procrastinate Now!
 
yup i need to close down the form (test case list) when i move to form (test case).Syntax/coding was never a point of strength of mine.

[Case number]=[Forms]![Assigned test list]![List0] is the query details which brings up form (test case)...so i need to arrive back at [Forms]![Assigned test list] with [List0] having [Case number] selected. Any ideas of how to have this coded sir?
 
like I said, declare a global variable somewhere in a module,
in the button click event to open the new form, save the value of the listbox to the global variable before closing the form,
in the onOpen event of the original form, test if there's a value in the global variable you declared, if so, assign the selected property of the listbox...

--------------------
Procrastinate Now!
 
yup..so i have setup a module (never have before so first for everything), then dropped in this piece of code

Option Compare Database

Dim listbox As String

listbox = [Forms]![Assigned test list]![List0] (ill need to have it selected somewhere but not sure where to incorporate this)...

then when i am onOpen of Assigned test list form i will set the value in of List0 to be listbox or something...does this sound like i am on the right track.Cheers
 
you need to make the variable global, otherwise you won't be able to set it from your forms

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top